Write a program that asks for a user's name and age, finds the ticket price based on the age, and prints out the user's name, age, and ticket price. The program must define the following 3 functions and call them in the main function. Create a function called getName that takes in no arguments and returns the name of the user.  Create a function called getAge that takes in the argument age and uses pass-by-reference to set the age of the user. Ensure that the user cannot put in an age that is negative or greater than 100.  Create a function called printTicket that takes in the user's name and age and does the following ○      If they are less than or equal to 13 years old set ticket_Price to 9.99. ○      If their age is greater than 13 and less than 65, set ticket_Price to 19.99. ○      If their age is greater than or equal to 65, set ticket_Price to 12.99. ○      Output to the console the user's name, age and ticket price.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false: a. To use a predefined function in a program, you...
icon
Related questions
Question

done in c++

Program Specifications:

Write a program that asks for a user's name and age, finds the ticket price based on the age, and prints out the user's name, age, and ticket price.

The program must define the following 3 functions and call them in the main function.

  1. Create a function called getName that takes in no arguments and returns the name of the user. 

  2. Create a function called getAge that takes in the argument age and uses pass-by-reference to set the age of the user. Ensure that the user cannot put in an age that is negative or greater than 100. 
  1. Create a function called printTicket that takes in the user's name and age and does the following

○      If they are less than or equal to 13 years old set ticket_Price to 9.99.

○      If their age is greater than 13 and less than 65, set ticket_Price to 19.99.

○      If their age is greater than or equal to 65, set ticket_Price to 12.99.

○      Output to the console the user's name, age and ticket price.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Variables
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr