Pseudo code
welcome_screen
Display text messages
“Welcome to DVDSTOVIEW”
“= = = = = = = = = = = = = = =”
a blank line
display_options
Display text messages
“We offer the following services”
“D. DVD List.”
“O. Order calculation”
a blank line
order_calc
Display “Order calculations”
“Please enter cost of DVD”
Accept input of DVDcost
Display “Please enter number of copies required”
Accept input of number of copies
if (number<4)
totalcost=DVDcostcost*number
Display “Small orders may be dispatched by special delivery to arrive within 2
Hours”
“Total cost including VAT is totalcost+VAT”
else
totalcost=DVDcost*number
Display “Total cost including VAT is totalcost+VAT”
genre_types
Display text messages
“Genre types available:”
“1. Sci-fi.”
“2. Crime.”
“3. Horror.”
“4. Romance.”
2 blank lines
DVD_list
Call function genre_types
Display “Please enter your type”
Accept input of choice
Switch
case 1
Display “1. Terminator1.”
Display “===============”
Display blank line
Display “Starring: Arnold Schwarzenegger, Michael Biehn.”
Display “Director: James Cameron.”
Display “Genre: Sci-Fi & Fantasy.”
Display “Format: Widescreen.”
Display “Language: English.”
Display “Subtitles: None.”
Display 2 blank lines
Display “2. Star wars: Episode 3(Revenge of the sith.”
Display”============================”
Display a blank line
Display “Starring: Ewan McGregor, Hayden Christensen.”
Display “Director: George Lucas.”
Display “Genre: Sci-Fi & Fantasy.”
Display “Format: Widescreen ...”
Display “Language: English ...”
Display 2 blank lines
case 2
Display “1. Crash.”
Display a blank line
Display “Starring: Sandra Bullock, Don Cheadle.”
Display “Director: Paul Haggis.”
Display “Genre: Crime.”
Display “Format: Widescreen.”
Display “Language: English.”
Display 2 blank lines
Display “2. Four brothers.”
Display “=================”
Display a blank line
Display “Starring: Mark Wahlberg, Tyrese Gibson.”
Display “Director: John Singleton.”
Display “Genre: Crime.”
Display “Format: Widescreen.”
Display “Language: English.”
Display 2 blank lines
case 3
Display “1. Resident evil.”
Display “=================”
Display a blank line
Display “Starring: Milla Jovovich, Sienna Guillory.”
Display “Director: Alexander Witt.”
Display “Genre: Horror.”
Display “Format: Widescreen.”
Display “Language: English.”
Display “Subtitles: English.”
Display 2 blank lines
Display “2. House of wax.”
Display “================”
Display a blank line
Display “Starring: Elisha Cuthbert, Chad Michael Murray.”
Display “Director: Jaume Serra.”
Display “Genre: Horror.”
Display “Format: Widescreen.”
Display “Language: English.”
Display “Subtitles: English.”
Display 2 blank lines
case 4
Display “1. Born romantic.”
Display “=================”
Display a blank line
Display “Starring: Williams, Olivia Ferguson, Craig Morrissey,”
Display “David Horrocks, Jane Mistry, Jimi McCormack, Catherine Lester, Adrian Thomson, John.”
Display “Directing: Kane, David.”
Display “Genre: Romance.”
Display 2 blank lines
Display “2. Shadow lands.”
Display “===============”
Display a blank line
Display “Starring: Anthony Hopkins, Debra Winger.”
Display “Director: Richard Attenborough.”
Display “Run time: 126 mins.”
Display “Genres: Romance.\n";
Display “Released: November 28, 2005.”
Display 2 blank lines
Default: Display “Wrong DVD genre, please re-enter choice.”
choose_option
do
call function display_options
Display “Please enter your choice:”
Accept input of option
switch
case D or d
call function DVD_list
Display 2 blank lines
case O or o
call function order_calc
Display 2 blank lines
Case ‘E’ or case ‘e’:
Display “Thank you for using DVDSTOVIEW.”
Default Display “You have entered an invalid option.”
while ((option !=’E’) && (option !=’e’))
Display “Message text:”
main
Call function welcome_screen
Call function choose_option
Call function display_options
Call function genre_types
TEST DATA TABLE (choose_option)
TEST DATA TABLE (welcome_screen)
TEST DATA TABLE (order_calc)
TEST DATA TABLE (DVD_list)
TEST DATA TABLE order_calc (number<4)/ (number>=4)
Software code
void order_calc() // gets order of DVDs and displays
// cost inclusive of VAT
{ // declare and initialise local variables
int number=1; // number of DVDs required
double totalcost=0.0; // total cost
float DVDcost=1.0; // cost of DVD chosen
const double VAT=11.75; // defines a constant VAt rate as 11.75
// set output to show currency format
cout.setf(ios::fixed); // sets a flag to fix the format of output
cout.setf(ios::showpoint); // sets a flag to show a decimal point
cout.precision(2); // sets the number of decimal places to two
{
cout << "\nOrder calculation." << endl<<endl;
aed aa// display 2 blank lines
cout << "\nPlease enter cost of DVD: ";
cin >> DVDcost;
}
{
cout << "\nPlease enter number of copies required: ";
cin >> number;
}
if (number<4)
{
totalcost=DVDcost*number;
cout << "\nSmall orders may be dispatched by special delivery to arrive within 2 hours.";
cout << "\nTotal cost including VAT is: ";
cout << totalcost+VAT; // total cost including VAT
}
else
{
totalcost=DVDcost*number;
cout << "\nTotal cost including VAT is: ";
cout << totalcost+VAT;
}
cout<<endl<<endl; // displays 2 blank lines
} // end function get_order
/**********************************************************************************/
void genre_types()
{
cout <<"\nGenre types available" <<endl; // display a blankn line
cout <<"\n1.\t Sci-Fi. \n";
cout <<"2.\t Crime. \n";
cout <<"3.\t Horror. \n";
cout <<"4.\t Romance. \n";
cout <<endl<<endl;
} // 2 blank lines
// end function genre_list
/************************************************************************************/
void DVD_list()
{
int choice =0;
genre_types();
cout <<"Please enter your type : \n";
cin >> choice;
switch(choice)
{
case 1: // if '1' input Sci-fi
cout <<"1. Terminator1.\n";
cout <<"===============" <<endl;
cout <<"Starring: Arnold Schwarzenegger, Michael Biehn.\n";
cout <<"Director: James Cameron.\n";
cout <<"Genre: Sci-Fi & Fantasy.\n";
cout <<"Format: Widescreen ...\n";
cout <<"Language: English.\n";
cout <<"Subtitles: None.\n";
cout <<endl<<endl; // displays 2 blank lines
cout <<"2. Star wars: Episode 3(Revenge of the sith.\n";
cout <<"============================================" <<endl;
cout <<"Starring: Ewan McGregor, Hayden Christensen.\n";
cout <<"Director: George Lucas.\n";
cout <<"Genre: Sci-Fi & Fantasy.\n";
cout <<"Format: Widescreen ...\n";
cout <<"Language: English ...\n";
cout <<endl<<endl;
break;
case 2: // if '2' input crime
cout <<"1. Crash.\n";
cout <<"=========" <<endl;
cout <<"Starring: Sandra Bullock, Don Cheadle .\n";
cout <<"Director: Paul Haggis.\n";
cout <<"Genre: Crime.\n";
cout <<"Format: Widescreen.\n";
cout <<"Language: English.\n";
cout <<endl<<endl; // desplays 2 blank line
cout <<"2. Four brothers.\n";
cout <<"=================" <<endl;
cout <<"Starring: Mark Wahlberg, Tyrese Gibson.\n";
cout <<"Director: John Singleton.\n";
cout <<"Genre: Crime.\n";
cout <<"Format: Widescreen.\n";
cout <<"Language: English.\n";
cout <<endl<<endl;
break;
case 3: // if '3' input horror
cout <<"1. Resident evil.\n";
cout <<"=================" <<endl;
cout <<"Starring: Milla Jovovich, Sienna Guillory.\n";
cout <<"Director: Alexander Witt.\n";
cout <<"Genre: Horror.\n";
cout <<"Format: Widescreen.\n";
cout <<"Language: English.\n";
cout <<"Subtitles: English.\n";
cout <<endl<<endl; // desplays 2 blank lines
cout <<"2. House of wax.\n";
cout <<"================" <<endl;
cout <<"Starring: Elisha Cuthbert, Chad Michael Murray.\n";
cout <<"Director: Jaume Serra.\n";
cout <<"Genre: Horror.\n";
cout <<"Format: Widescreen.\n";
cout <<"Language: English.\n";
cout <<"Subtitles: English.\n";
cout <<endl<<endl; // displays 2 blank lines
break;
case 4:
cout <<"1. Born romantic.\n";
cout <<"=================" <<endl;
cout <<"Starring: Williams, Olivia Ferguson, Craig Morrissey, \n";
cout <<"David Horrocks, Jane Mistry, Jimi McCormack, Catherine Lester, Adrian Thomson, John.\n";
cout <<"Directing: Kane, David.\n";
cout <<"Genre: Romance.\n";
cout <<endl<<endl; // displays 2 blank line
cout <<"2. Shadow lands.\n";
cout <<"===============" <<endl;
cout <<"Starring: Anthony Hopkins, Debra Winger.\n";
cout <<"Director: Richard Attenborough.\n";
cout <<"Run time: 126 mins.\n";
cout <<"Genres: Romance.\n";
cout <<"Released: November 28, 2005.\n";
cout <<endl<<endl; // displays 2 blank lines
break;
default:
cout <<"Wrong DVD genre, Please re-enter choice";
}
// end switch (DVD_list)
// end function DVD_list
system("pause"); // pauses until user presses a key
system("cls"); // clears screen
} // end function DVD_list
/********************************************************************/
void choose_option() // choose option from menu
{ // declare and initialise local variables
char option = ' '; // menu option
do
{ // do while (( option != 'E' ) && ( option != 'e'))
display_options(); // call function to display options
cout << "\nPlease enter your choice : ";
cin >> option;
switch(option) // selection of pathway dependant on option
{
case 'D':
case 'd': // if 'D' or 'd' input DVD List
{
DVD_list();
cout << endl << endl; // displays 2 blank lines
break;
}
case 'O':
case 'o': // if 'O' or'o' input order calculator
{
order_calc();
cout << endl << endl; // display 2 blank lines
break;
}
case 'E':
case 'e': // if 'e' or 'E' exit
{
cout <<"Thank you for using DVDSTOVIEW.";
cout << endl << endl; // display 2 blank lines
break;
}
default:
cout <<"You have entered an invalid option. ";
} // end switch (option)
}while (( option != 'E' ) && ( option != 'e'));
// end do while (option ! exit)
// end function choose_option
}
/***********************************************************************/
/***************************************************************/
int main() // main function
{
welcome_screen(); // calls function welcome_screen
choose_option(); // calls function choose_option
display_options(); // calls function display_options
genre_types(); // calls function genre_types
return(0);
} // end main function