Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that asks the user to enter a string that holds the values d or n and an integer

Write a program that asks the user to enter a string that holds the values "d" or "n" and an integer that holds a person's age, and outputs a movie ticket price. Movie prices are free for everyone under the age of 4. Daytime prices are $10 for everyone age 4 or higher. Nighttime prices are $11 for ages 4-16, $14 for ages 17-64 and $12 for ages 65 and above.Be sure to INCLUDE the program documentation and to follow the Program Submissions Guidelines document from the readings last
week.
Do NOT use methods or procedures that are beyond what we have covered in class so far - including loops, user defined functions, etc.
You will receive a score of 0 if you do.
Write your program directly in the code editor below. Click on the "Tutorial" button to the right to understand how to use the editor and
console. Click on the "Run" button to execute the code and interact with the console window below the editor. Make sure that you follow
the input and out formats.
Write a program that asks the user to enter a string that holds the values "d" or "n" and an integer that holds a person's age, and outputs
a movie ticket price. Movie prices are free for everyone under the age of 4. Daytime prices are $10 for everyone age 4 or higher.
Nighttime prices are $11 for ages 4-16, $14 for ages 17-64 and $12 for ages 65 and above.
You should also validate the input of the movie time to allow the entry of only 'd' or 'n'.(hint: Check Special Topic: Terminating a
Program)
Ex: If the input is:
Enter the movie time ('d' for day or 'n' for night): n
What is the age of the ticket buyer: 15
the output is:
The ticket price is $15
For the input validation: If the input is:
Enter the movie time ('d' for day or 'n' for night): k
the output is:
Error: you must enter 'd' or 'n' only
You should also validate the input of the movie time to allow the entry of only 'd' or 'n'.(hint: Check Special Topic: Terminating a Program)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago