Advertisement
desislava_topuzakova

05. Small Shop

Jan 23rd, 2022
797
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     string productName, town;
  6.     double quantity;
  7.     double price = 0;
  8.     cin >> productName >> town >> quantity;
  9.    
  10.     if (town == "Sofia")
  11.     {
  12.         if (productName == "coffee")
  13.         {
  14.             price = 0.5;
  15.             cout << quantity * price << endl;
  16.         }
  17.         else if (productName == "peanuts")
  18.         {
  19.             price = 1.6;
  20.             cout << quantity * price << endl;
  21.         }
  22.         else if (productName == "water")
  23.         {
  24.             price = 0.8;
  25.             cout << quantity * price << endl;
  26.         }
  27.         else if (productName == "beer")
  28.         {
  29.             price = 1.2;
  30.             cout << quantity * price << endl;
  31.         }
  32.         else if (productName == "sweets")
  33.         {
  34.             price = 1.45;
  35.             cout << quantity * price << endl;
  36.         }
  37.     }
  38.     else if (town == "Plovdiv")
  39.     {
  40.         if (productName == "coffee")
  41.         {
  42.             price = 0.4;
  43.             cout << quantity * price << endl;
  44.         }
  45.         else if (productName == "peanuts")
  46.         {
  47.             price = 1.5;
  48.             cout << quantity * price << endl;
  49.         }
  50.         else if (productName == "water")
  51.         {
  52.             price = 0.7;
  53.             cout << quantity * price << endl;
  54.         }
  55.         else if (productName == "beer")
  56.         {
  57.             price = 1.15;
  58.             cout << quantity * price << endl;
  59.         }
  60.         else if (productName == "sweets")
  61.         {
  62.             price = 1.30;
  63.             cout << quantity * price << endl;
  64.         }
  65.     }
  66.     else if (town == "Varna")
  67.     {
  68.         if (productName == "coffee")
  69.         {
  70.             price = 0.45;
  71.             cout << quantity * price << endl;
  72.         }
  73.         else if (productName == "peanuts")
  74.         {
  75.             price = 1.55;
  76.             cout << quantity * price << endl;
  77.         }
  78.         else if (productName == "water")
  79.         {
  80.             price = 0.7;
  81.             cout << quantity * price << endl;
  82.         }
  83.         else if (productName == "beer")
  84.         {
  85.             price = 1.1;
  86.             cout << quantity * price << endl;
  87.         }
  88.         else if (productName == "sweets")
  89.         {
  90.             price = 1.35;
  91.             cout << quantity * price << endl;
  92.         }
  93.     }
  94.     return 0;
  95. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement