QuestionQuestion

Write a do-while loop for a ticket-taker to determine the price for a ticket.

The base price is $25.00, but people 55 and over get a $5.00 discount. Children under 10 years old get a $6.50 discount, and children under 5 are free.

Declare constants, and use them in your code, not hard-coded numbers.

You must calculate the price, not just have code that says the ticket is 20.00.

Format output with 2 decimal places.

After selling each ticket, ask if you want to sell another ticket (Y/N)? If Y, run the loop again, if not, exit your program with a message such as: Good Bye.

Sample output:

What is age of ticket buyer? 32

The ticket is 25.00

Do you want to sell another ticket (Y/N)? Y

What is the age of ticket buyer? 59

The ticket is 20.00

Do you want to sell another ticket (Y/N)? Y

What is the age of ticket buyer? 6

The ticket is 18.50

Do you want to sell another ticket (Y/N)? Y

What is the age of ticket buyer? 4

The ticket is free

Do you want to sell another ticket (Y/N)? N

Good Bye

(for the output the ticket has to say free not 0)

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

#include <iostream>

#define NORMALPRICE 25.00
#define SENIORPRICE 20.00
#define UNDERTEN 18.50

using namespace std;

int main()
{
    int age;
    char exit;
    do
    {
   cout << "Please enter the age of the ticket buyer: ";
   cin >> age;

   if(age < 0)
cout << "Incorrect age, please try again" << endl;
   else if( age < 5)
cout << "The ticket is free" << endl;...
$15.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available C-Family Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats