Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<iomanip>
- #include<string>
- using namespace std;
- void print_menu();
- int input_choice(int menuChoice);
- char input_type(char sport);
- int input_age(int userAge);
- double compute_rate(double patronRate);
- int input_reservation();
- void print_all();
- int main()
- {
- int menuChoice;
- int userAge;
- input_choice(menuChoice);
- input_age(userAge);
- return 0;
- }
- void print_menu()
- {
- cout << "Please pick from the following menu" << endl;
- cout << "1. Add a new reservation" << endl;
- cout << "2. Print all reservations" << endl;
- cout << "3. Print all reservations for a given sport" << endl;
- cout << "4. Quit" << endl;
- }
- int input_choice(int choice)
- {
- print_menu();
- cin >> choice;
- if (choice == 1)
- {
- cout << "Please enter f/F for flying, g/G for gliding and h/H for hang-gliding" << endl;
- cin >> choice;
- }
- return choice;
- }
- char input_type(char sport)
- {
- return sport;
- }
- int input_age(int userAge)
- {
- cout << "Please enter the age of the patron, minimum 16" << endl;
- cin >> userAge;
- return userAge;
- }
- double compute_rate(double patronRate)
- {
- char sport;
- int userAge;
- input_age(userAge);
- input_type(sport);
- if (((userAge >= 21) && (sport == 'F')) || ((userAge >= 21) && (sport == 'f')))
- {
- patronRate = 68.95;
- cout << "The insurance rate is $" << patronRate << endl;
- }
- return patronRate;
- }
Advertisement
Add Comment
Please, Sign In to add comment