MartinPaunov

Fruit-Shop

Apr 22nd, 2018
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10. int main()
  11. {
  12.     string fruit, day;
  13.     double quantity;
  14.     cin >> fruit >> day >> quantity;
  15.     if (day == "Monday" || day == "Tuesday" || day == "Wednesday" || day == "Thursday" || day == "Friday")
  16.     {
  17.         if (fruit == "banana")
  18.         {
  19.             cout << fixed << setprecision(2) << quantity * 2.50 << endl;
  20.         }
  21.         else if (fruit == "apple")
  22.         {
  23.             cout << fixed << setprecision(2) << quantity * 1.20 << endl;
  24.  
  25.         }
  26.         else if (fruit == "orange")
  27.         {
  28.             cout << fixed << setprecision(2) << quantity * 0.85 << endl;
  29.         }
  30.         else if (fruit == "grapefruit")
  31.         {
  32.             cout << fixed << setprecision(2) << quantity * 1.45 << endl;
  33.         }
  34.         else if (fruit == "kiwi")
  35.         {
  36.             cout << fixed << setprecision(2) << quantity * 2.70 << endl;
  37.         }
  38.         else if (fruit == "pineapple")
  39.         {
  40.             cout << fixed << setprecision(2) << quantity * 5.50 << endl;
  41.         }
  42.         else if (fruit == "grapes")
  43.         {
  44.             cout << fixed << setprecision(2) << quantity * 3.85 << endl;
  45.         }
  46.         else {
  47.             cout  << fixed << setprecision(2) << "error" << endl;
  48.         }
  49.     }
  50.     else if (day == "Saturday" || day == "Sunday")
  51.     {
  52.         if (fruit == "banana")
  53.         {
  54.             cout << fixed << setprecision(2) << quantity * 2.70 << endl;
  55.         }
  56.         else if (fruit == "apple")
  57.         {
  58.             cout << fixed << setprecision(2) << quantity * 1.25 << endl;
  59.  
  60.         }
  61.         else if (fruit == "orange")
  62.         {
  63.             cout << fixed << setprecision(2) << quantity * 0.90 << endl;
  64.         }
  65.         else if (fruit == "grapefruit")
  66.         {
  67.             cout << fixed << setprecision(2) << quantity * 1.60 << endl;
  68.         }
  69.         else if (fruit == "kiwi")
  70.         {
  71.             cout << fixed << setprecision(2) << quantity * 3.00 << endl;
  72.         }
  73.         else if (fruit == "pineapple")
  74.         {
  75.             cout << fixed << setprecision(2) << quantity * 5.60 << endl;
  76.         }
  77.         else if (fruit == "grapes")
  78.         {
  79.             cout << fixed << setprecision(2) << quantity * 4.20 << endl;
  80.         }
  81.         else
  82.         {
  83.             cout << fixed << setprecision(2) << "error" << endl;
  84.         }
  85.     }
  86.     else{
  87.         cout << "error" << endl;
  88.     }
  89.  
  90.  
  91.  
  92.  
  93.     return 0;
  94.     }
Advertisement
Add Comment
Please, Sign In to add comment