Here is what I have so far..... #include <iostream> #include <iomanip> using nam
ID: 3632235 • Letter: H
Question
Here is what I have so far.....#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)? ";
}
What am I missing for this yet? Please Help? My question is below for the problem to solve.....
Design a program that ask a user for their age and whether or not they have a discount coupon. If they are over the age of 17 then the ticket price is $8.00. If they are not over 17 then the ticket price is $6.00. If they input y for coupon then the ticket price discount is 25%.
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;
cout<<"Your ticket is $"<<setprecision(2)<<fixed<<price<<endl;
system("pause");
return 0;
}