SHARE
TWEET

03. Sushi Time

kmilewa Jul 21st, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6. int main () {
  7.     string sushiType;
  8.     string restorantName;
  9.     string portion;
  10.     string order;
  11.     getline (cin, sushiType);
  12.     getline (cin, restorantName);
  13.     getline(cin,  portion);
  14.     getline (cin, order);
  15.    
  16.     int portions = stoi(portion);
  17.     bool restorantNameCorrect = restorantName == "Sushi Zone"
  18.                             || restorantName == "Sushi Time"
  19.                             || restorantName == "Sushi Zone"
  20.                             || restorantName == "Asian Pub";
  21.  
  22.     double price = 0.0;
  23.  
  24.     if (restorantName == "Sushi Zone") {
  25.         if (sushiType == "sashimi") {
  26.             price = portions * 4.99;
  27.         }else if (sushiType == "maki") {
  28.             price = portions * 5.29;
  29.         } else if (sushiType == "uramaki") {
  30.             price = portions * 5.99;
  31.         } else if (sushiType == "temaki") {
  32.             price = portions * 4.29;
  33.         }
  34.     } else if (restorantName == "Sushi Time") {
  35.         if (sushiType == "sashimi") {
  36.             price = portions * 5.49;
  37.         }else if (sushiType == "maki") {
  38.             price = portions * 4.69;
  39.         } else if (sushiType == "uramaki") {
  40.             price = portions * 4.49;
  41.         } else if (sushiType == "temaki") {
  42.             price = portions * 5.19;
  43.         }
  44.     } else if (restorantName == "Sushi Bar") {
  45.         if (sushiType == "sashimi") {
  46.             price = portions * 5.25;
  47.         }else if (sushiType == "maki") {
  48.             price = portions * 5.55;
  49.         } else if (sushiType == "uramaki") {
  50.             price = portions * 6.25;
  51.         } else if (sushiType == "temaki") {
  52.             price = portions * 4.75;
  53.         }
  54.     } else if (restorantName == "Asian Pub") {
  55.         if (sushiType == "sashimi") {
  56.             price = portions * 4.50;
  57.         }else if (sushiType == "maki") {
  58.             price = portions * 4.80;
  59.         } else if (sushiType == "uramaki" || sushiType == "temaki") {
  60.             price = portions * 5.50;
  61.         }
  62.     }
  63.  
  64.     double delivery = price + (price * 0.20);
  65.     double noDelivery = price;
  66.  
  67.     if (!restorantNameCorrect) {
  68.         cout << restorantName << " is invalid restaurant!\n";
  69.     } else {
  70.         if (order == "Y") {
  71.             cout << "Total price: " << ceil(delivery) << " lv.\n";
  72.         } else if (order == "N") {
  73.             cout << "Total price: " << ceil(noDelivery) << " lv.\n";
  74.         }
  75.     }
  76.  
  77.  
  78.     return 0;
  79. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top