You are to write a program that will allow the user to select from a menu of 3 movies available to watch. The menu should look like the following:
If the user asks to watch Movie 1, ask for the number of tickets to buy and print the total to pay. The price per ticket for Movie 1 is $8.
If the user asks to watch Movie 2, then the program must ask for his/her age before it proceeds. If the user is younger than 18 years old, the program must print a message saying "Sorry you must be 18 or older to watch this movie." If the user is 18 or older, then proceed to ask how many tickets the user wants and print the total to pay. Price per ticket for Movie 2 is $10.
If the user asks to watch Movie 3, ask for the number of tickets to buy and print the total to pay. The price per ticket for Movie 3 is $6.50.
Start
Declare Integer selectedMovie
Declare Integer nTickets
Declare Real total
Declare Integer age
Display "Movie 1: Venom: Let There be Carnage"
Display "Movie 2: Halloween Kills"
Display "Movie 3: Vivo"
Input selectedMovie
if selectedMovie = 1 then
Display "Enter the number of tickets to buy: "
Input nTickets
Set total=nTickets*8
Display "The total to pay: ",total
end if
if selectedMovie = 2 then
Display "Enter age: "
Input age
if age<18 then
Display "Sorry you must be 18 or older to watch this movie."
else
Display "Enter the number of tickets to buy: "
Input nTickets
Set total=nTickets*10
Display "The total to pay: ",total
End if
end if
if selectedMovie = 3 then
Display ""Enter the number of tickets to buy: "
Input nTickets
Set total=nTickets*6.50
Display "The total to pay: ",total
end if
Stop
Comments
Leave a comment