Ask Experts Questions for FREE Help !
Ask
    noorahtt's Avatar
    noorahtt Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 23, 2012, 02:45 AM
    musem tickets using c
    Write a C program for the calculation of the total price of the tickets that a group of visitors will pay to enter a museum .The regular price is 10.0 U.S per visitor. However students get 30% reduction , kids under 5 do not pay , kids between 5 and 10 have 50% reduction , and visitors above 60 have 20% reduction . In addition , if the number of visitors is more than 10, 15% reduction will be applied to the total price of the tickets.Write C program that ask the user to enter the number of student and number if the kids under 5 and the number of kids between 5 and 10 and the number of visitors above 60 and the number of visitors who do not have any special discounts .The program will calculate and display the total amount of the tickets requested ;

    I try this but not sure
    #include<iostream>
    using namespace std;
    int main()
    {
    double TotalPrice ,kids1,kids2,student ,vistor,vistor1;
    double const price=10.0 ;
    double ticket1,ticket2,ticket3,ticket4,ticket5;
    cout<<"Enter the number of students : ";
    cin>>student;
    cout<<"Enter the number of kids under 5 : ";
    cin>>kids1;
    cout<<"Enter the number of kids betwwen 5 and 10 : ";
    cin>>kids2;
    cout<<"Enter the number of vistor above 60 : ";
    cin>>vistor;
    cout<<"Enter the number of vistor with no discount: ";
    cin>>vistor;

    ticket1=price*student*0.3;
    ticket4=price*vistor*0.2;
    ticket2=price*kids1*0.0;
    ticket3=price*kids2*0.5;
    ticket5=price*vistor*0.15;
    if(vistor==student)
    {
    cout<<"The ticket price is : "<<ticket1<<endl;
    }
    else if(vistor==kids1 && vistor<5)
    {
    cout<<"The ticket price is : "<<ticket2<<endl;
    }
    else if(vistor==kids2 && vistor>=5 &&vistor<=10)
    {
    cout<<"The ticket price is : "<<ticket3<<endl;
    }
    else if(vistor==vistor && vistor>=60)
    {
    cout<<"The ticket price is : "<<ticket4<<endl;
    }
    else if(vistor==vistor && vistor>=10)
    {
    cout<<"The ticket price is : "<<ticket5<<endl;
    }
    TotalPrice= ticket1 ticket2 ticket3 ticket4 ticket5;

    cout<<"The total price is : "<<TotalPrice<<" U.S "<<endl;
    system("pause");
    return 0;
    }

Check out some similar questions!

I have got three NJ tickets what should I do [ 7 Answers ]

Hello, I got my NJ license a month back. I got three tickets - Careless Driving, Leaving Scene of accident and Failure to report accident. There was no personal injury but property damage did happen. I stopped at yellow signal and vehicle behind me couldn't stop and it hit my vehicle. I was...

Hockey tickets [ 2 Answers ]

I want to get my son tickets to a game. I can't afford anything center ice except nose bleeds, but can get decent corner ones. They call them attack zones, I guess. Anyway, I don't know if he would rather be near the team he likes goal, or the other teams goal. Sounds silly, but I just don't...

30% of tickets sold were kids tickets, selling at $4. The rest were sold at $8.50. [ 1 Answers ]

30% of the tickets sold by a movie theater for the Friday night show were children's tickets at $4 each. The rest of the tickets were sold at the full price of $8.50. The movie theater collected $252 for the children's tickets. How many tickets did they sell in all? How do you know?

Parking tickets [ 1 Answers ]

What happens if I have unpaid parking tickets in California? Is there payment options or community service

Football tickets [ 1 Answers ]

Hi. I don't know if anyone can help me. Ive tried getting tickets to a football game but they sold out. I have found a website where people can sell their tickets but the tickets have that persons name on them. Will it be OK to buy the ticket even if its got someone else's name on it or will I be...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.