Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. //
  2. // main.cpp
  3. // gym.cpp
  4. //
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11. string customername;
  12. string membershiptype;
  13. double trainingsessionscost = 10.00;
  14. double trainingsessions;
  15. double trainingsessionstotal = 0.0;
  16. double total = 0.0;
  17. double initiationfee = 19.99;
  18.  
  19. cout.setf(ios::fixed);
  20. cout.precision(2);
  21.  
  22.  
  23. cout << "Customer Name: ";
  24. getline( cin, customername );
  25.  
  26. if (customername.length() == 0 )
  27. {
  28. cout << "---You must enter a customer name";
  29. } else
  30.  
  31.  
  32. cout << "Training Sessions per month: ";
  33. cin >> trainingsessions;
  34. if (trainingsessions < 0 ) {cout << "---The sessions used must not be negative ";}
  35.  
  36. cout << "Membership type: ";
  37. cin >> membershiptype;
  38.  
  39. if (membershiptype != "Executive" && membershiptype != "Regular") {
  40. cout << "---The membership type is not valid ";
  41. }
  42.  
  43. {
  44. if (membershiptype == "Executive")
  45. {total += 55.00;}
  46. }
  47.  
  48. if (membershiptype == "Regular")
  49. {total += 30.00;}
  50.  
  51. if (trainingsessions == 0 && membershiptype == "Regular")
  52. {total += 19.99;}
  53.  
  54.  
  55.  
  56.  
  57. trainingsessionstotal = trainingsessionscost * trainingsessions;
  58.  
  59. total += trainingsessionstotal;
  60.  
  61.  
  62. cout << "---The membership fee for " << customername << " is " << "$" <<total << endl;
  63.  
  64.  
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement