Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. string fruit, day;
  9. double quantity;
  10.  
  11. cin >> fruit >> day >> quantity;
  12.  
  13. double price = 0;
  14.  
  15. if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  16. {
  17. if (fruit == "banana")
  18. price = 2.50;
  19. else if (fruit == "apple")
  20. price = 1.20;
  21. else if (fruit == "orange")
  22. price = 0.85;
  23. else if (fruit == "grapefruit")
  24. price = 1.45;
  25. else if (fruit == "kiwi")
  26. price = 2.70;
  27. else if (fruit == "pineapple")
  28. price = 5.50;
  29. else if (fruit == "grapes")
  30. price = 3.85;
  31. else
  32. cout << "error" << endl;
  33. }
  34. else if (day == "Saturday" || day == "Sunday")
  35. {
  36. if (fruit == "banana")
  37. price = 2.70;
  38. else if (fruit == "apple")
  39. price = 1.25;
  40. else if (fruit == "orange")
  41. price = 0.90;
  42. else if (fruit == "grapefruit")
  43. price = 1.60;
  44. else if (fruit == "kiwi")
  45. price = 3;
  46. else if (fruit == "pineapple")
  47. price = 5.60;
  48. else if (fruit == "grapes")
  49. price = 4.20;
  50. else {
  51. cout << "error" << endl;
  52. }
  53. cout.setf(ios::fixed);
  54. cout.precision(2);
  55.  
  56. cout << price * quantity << endl;
  57.  
  58.  
  59. return 0;
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement