Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a program that will ask the users to input their age and whether or not t

ID: 3622186 • Letter: D

Question

Design a program that will ask the users to input their age and whether or not they have a discount coupon. If the age is greater than 17, set the ticket price to be eiht dollars, and if the age is not greater than 17, set the ticket to be six dollars. If the user has a discount coupon, reduce the the ticket price by 25 percent.Output the ticket price.
(Hint: use an integer variable for the price and an charcter variable for the discount, i.e, ask the users to enter a y if they have a coupon and an n if they do not.)

Explanation / Answer

please rate - thanks

#include <iostream>
#include<iomanip>
using namespace std;
int main()
{char discount;
int age;
double price;
cout<<"How old are you? ";
cin>>age;
if(age>17)
    price=8;
else
    price=6;
cout<<"Do you have a discount ticket(y/n)? ";
cin>>discount;
if(discount=='y'||discount=='Y')
     price=.75*price;
cout<<"The price of your ticket is $"<<setprecision(2)<<fixed<<price<<endl;
system("pause");
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote