Advertisement
eggmasta

Untitled

Sep 15th, 2019
329
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. const float COST_EYE = 3.35;
  6. const float COST_SPLEEN = 2.75;
  7. const float COST_LIVER = 14.58;
  8. const float COST_APPENDIX = 0.50;
  9. const float COST_BRAINS = 7.85;
  10. const float COST_EAR = 13.45;
  11.  
  12. //const float WT_BRAIN = 0.4;
  13. //const float WT_SPLEEN = 5.6;
  14. //const float WT_LIVER = 3.0;
  15. //const float WT_APPENDIX = 1.2;
  16. //const float WT_EYE = 2.3;
  17. //const float WT_EAR = 10.0;
  18.  
  19. char input;
  20. bool quit = 0;
  21. float amount_paid;
  22.  
  23. cout.setf(ios::fixed);
  24. cout.setf(ios::showpoint);
  25. cout.precision(2);
  26.  
  27. while(quit == 0)
  28. {
  29. cout << "MAIN MENU" << endl;
  30. cout << "1.) eyeballs" << endl;
  31. cout << "2.) spleen" << endl;
  32. cout << "3.) liver" << endl;
  33. cout << "4.) appendix" << endl;
  34. cout << "5.) brains" << endl;
  35. cout << "6.) earlobes" << endl;
  36. cout << "7.) Quit" << endl;
  37.  
  38. cin >> input;
  39.  
  40. switch(input)
  41. {
  42. case '1':
  43. cout << "That will cost $" << COST_EYE << endl;
  44. cout <<"Please insert cash: ";
  45. cin >> amount_paid;
  46. break;
  47. case '2':
  48. cout << "That will cost $" << COST_SPLEEN << endl;
  49. cout <<"Please insert cash: ";
  50. cin >> amount_paid;
  51. break;
  52. case '3':
  53. cout << "That will cost $" << COST_LIVER << endl;
  54. cout <<"Please insert cash: ";
  55. cin >> amount_paid;
  56. break;
  57. case '4':
  58. cout << "That will cost $" << COST_APPENDIX << endl;
  59. cout <<"Please insert cash: ";
  60. cin >> amount_paid;
  61. break;
  62. case '5':
  63. cout << "That will cost $" << COST_BRAINS << endl;
  64. cout <<"Please insert cash: ";
  65. cin >> amount_paid;
  66. break;
  67. case '6':
  68. cout << "That will cost $" << COST_EAR << endl;
  69. cout <<"Please insert cash: ";
  70. cin >> amount_paid;
  71. break;
  72. case '7':
  73. quit = 1;
  74. break;
  75. default:
  76. cout << "ERROR. Invalid Input. Try Again" << endl;
  77. }
  78. }
  79. return 0;
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement