Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<string.h>
- #include<ctype.h>
- using namespace std;
- int calcAdult(char);
- int calcKids(char);
- void dispMostPeople(int,int);
- void dispOutput(int,int,float);
- main()
- {
- int age,stop,sum=0,count=0,kids=0,adult=0;
- float ticket_price,average;
- char ticket;
- bool choice = true;
- cout << " WELCOME TO NISSAN STADIUM SYSTEM'S TICKET\n ~THE HOME OF THE SAILORS!!!~.";
- cout << "\n TICKET INFORMATION";
- cout << "\n--------------------------------------------------------------------";
- cout << "\n~|YOKOHAMA F-MARINOS VS URAWA REDS DIAMONDS|~";
- cout << "\n\tJ1 LEAGUE MATCHES";
- cout << "\n DATE:31ST DECEMBER 2017,TIME:2000 HRS(JAPANESE TIME)";
- cout << "\n\n<(A)SS-WEST GATE>[ADULT(5,300 JPY)/KIDS(2,100 JPY)]\n<(B)NON RESERVED SEAT(NORTH GATE,EAST GATE)>[ADULT(2,500 JPY)/KIDS(1,000 JPY)]\n<(C)AWAY FANS(SOUTH GATE)>[ADULT(2,500 JPY)/KIDS(1,000 JPY)]";
- cout << "\n\n***PLEASE NOTED THAT THE KIDS TICKET IS ONLY APPLIED TO THE KIDS UNDER 15 YEARS OLD***";
- while(choice)
- {
- cout << "\n\nEnter your age:";
- cin >> age;
- cout <<"Select your ticket category:";
- cin >> ticket;
- ticket = toupper(ticket);
- if(age>=15)
- {
- ticket_price=calcAdult(ticket);
- adult++;
- }
- else
- if(age > 0 && age < 15)
- {
- ticket_price =calcKids(ticket);
- kids++;
- }
- else
- cout <<"Sorry!but your choice is invalid!!!";
- sum = sum + ticket_price;
- count++;
- average = sum/count;
- cout << "Press 0 if you want to stop or another button to continue:";
- cin >> stop;
- if(stop==0)
- choice=false;
- }
- dispMostPeople(kids,adult);
- dispOutput(sum,count,average);
- }
- int calcAdult(char tic)
- {
- int a=0,b=0,price;
- if (tic == 'A')
- price=5300;
- else
- if(tic == 'B')
- price=2500;
- else
- if(tic=='C')
- price=2500;
- else
- cout <<"Sorry!but your choice is invalid!!!";
- return price;
- }
- int calcKids(char tic)
- {
- int price;
- if (tic == 'A')
- price=2100;
- else
- if(tic == 'B')
- price=1000;
- else
- if(tic=='C')
- price=1000;
- else
- cout <<"Sorry!but your choice is invalid!!!";
- return price;
- }
- void dispMostPeople(int kid,int adlt)
- {
- if(adlt > kid)
- cout << "\nThe most people who like to come to the stadium was adult with "<< adlt << " people";
- else
- if(kid > adlt)
- cout << "\nThe most people who like to come to the stadium was kids with "<< kid<< " people";
- else
- cout << "\nThe number of the adult and kids fans are same with "<< adlt << " people";
- }
- void dispOutput(int s,int c,float avg)
- {
- cout <<"\nYou want to buy :"<< c <<" tickets";
- cout <<"\nThe total price is :"<< s <<" JPY";
- cout <<"\nThe average ticket price for one person is :"<< avg << " JPY";
- cout <<"\nThank you and enjoy your match :) ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement