Guest User

codeHelp

a guest
Apr 15th, 2016
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. #include<string>
  4.  
  5. using namespace std;
  6.  
  7. void print_menu();
  8. int input_choice(int menuChoice);
  9. char input_type(char sport);
  10. int input_age(int userAge);
  11. double compute_rate(double patronRate);
  12. int input_reservation();
  13. void print_all();
  14.  
  15. int main()
  16. {
  17. int menuChoice;
  18. int userAge;
  19.  
  20. input_choice(menuChoice);
  21. input_age(userAge);
  22.  
  23.  
  24. return 0;
  25. }
  26.  
  27. void print_menu()
  28. {
  29. cout << "Please pick from the following menu" << endl;
  30. cout << "1. Add a new reservation" << endl;
  31. cout << "2. Print all reservations" << endl;
  32. cout << "3. Print all reservations for a given sport" << endl;
  33. cout << "4. Quit" << endl;
  34.  
  35. }
  36.  
  37. int input_choice(int choice)
  38. {
  39. print_menu();
  40. cin >> choice;
  41.  
  42. if (choice == 1)
  43. {
  44. cout << "Please enter f/F for flying, g/G for gliding and h/H for hang-gliding" << endl;
  45. cin >> choice;
  46.  
  47. }
  48.  
  49.  
  50.  
  51. return choice;
  52. }
  53. char input_type(char sport)
  54. {
  55. return sport;
  56. }
  57. int input_age(int userAge)
  58. {
  59. cout << "Please enter the age of the patron, minimum 16" << endl;
  60. cin >> userAge;
  61.  
  62. return userAge;
  63. }
  64. double compute_rate(double patronRate)
  65. {
  66. char sport;
  67. int userAge;
  68.  
  69. input_age(userAge);
  70. input_type(sport);
  71.  
  72. if (((userAge >= 21) && (sport == 'F')) || ((userAge >= 21) && (sport == 'f')))
  73. {
  74. patronRate = 68.95;
  75. cout << "The insurance rate is $" << patronRate << endl;
  76. }
  77.  
  78. return patronRate;
  79. }
Advertisement
Add Comment
Please, Sign In to add comment