Advertisement
Guest User

PlanProgram

a guest
Feb 20th, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. // plan rates
  7. const float planA = 39.99;
  8. const float planB = 59.99;
  9. const float planC = 69.99;
  10.  
  11. // minutes allowed per plan
  12. const int limitA = 450;
  13. const int limitB = 900;
  14.  
  15. // rates for additional minutes
  16. const float additionalMinutesA = 0.45;
  17. const float additionalMinutesB = 0.40;
  18.  
  19. // choose plan
  20. float plan;
  21.  
  22. // total minutes used
  23. float totalMinutes;
  24.  
  25. // amount charged
  26. float amountChargedA = (totalMinutes - limitA) * additionalMinutesA;
  27. float amountChargedB = (totalMinutes - limitB) * additionalMinutesB;
  28. float amountChargedC = planC;
  29.  
  30.  
  31. cout << "Voice plans: " << endl;
  32. cout << "A. The 450 minute plan" << endl;
  33. cout << "B. The 900 minute plan" << endl;
  34. cout << "C. The unlimited plan" << endl;
  35.  
  36. cout << "Enter which voice plan the customer subscribes to: ";
  37. cin >> plan;
  38.  
  39. cout << "Enter the total number of minutes used during the month: ";
  40. cin >> totalMinutes;
  41.  
  42. cout << endl;
  43.  
  44. if (planA) {
  45. cout << "The amount due for the month is $" << amountChargedA << endl;
  46. cout << "Amount saved if you were on Plan B: $" << (amountChargedA - amountChargedB) << endl;
  47. cout << "Amount saved if you were on Plan C: $" << (amountChargedA - amountChargedC) << endl;
  48. }
  49.  
  50. else if (planB) {
  51. cout << "The amount due for the month is $" << amountChargedB << endl;
  52. cout << "Amount saved if you were on Plan C: $" << (amountChargedB - amountChargedC) << endl;
  53. }
  54.  
  55. else if (planC) {
  56. cout << "The amount due for the month is $" << amountChargedC << endl;
  57. }
  58.  
  59. else (plan != planA || plan != planB || plan != planC); {
  60. cout << "The voice plan entered is invalid." << endl;
  61. }
  62.  
  63. cout << endl;
  64.  
  65. return 0;
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement