Write a program using if-statements to print out the concert ticket price according to audience’s age. You must include a while loop so the program can execute three times for people with three different ages.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section5.5: A Closer Look: Loop Programming Techniques
Problem 13E
icon
Related questions
icon
Concept explainers
Question

 

Write a program using if-statements to print out the concert ticket price according to audience’s age. You must include a while loop so the program can execute three times for people with three different ages.

  • Your program should ask the user to enter age. 
  • Your program should determine using if-statements the price of the concert ticket based on the entered age. 
  • Your program should then print out the price of the ticket. 
  • Your program should use a while loop to repeat the mentioned process above three times. 

The following are the ticket price range for different age group:

If a person is under 12 the price of the ticket is $10.

If the person is 65 or older the ticket price is $8.

If the person age is 12 or older but less than 65 the ticket price is $20.

Solution (pseudo-code)

set total to zero

set loop counter to 1

While loop counter is less than or equal to 3 do the following

            Initialize total

            enter age

                        if age< 12

                                     print ticket price=$10

                         

            if age equal or > 65

                                     print ticket price=$8

                       

            otherwise

                        print charge=$20

                       

            increment loop counter by one

END     (after 3 times through the while loop)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,