Advertisement
tsvetelinapasheva

TsvetelinaPasheva/ConditionalStatementsAdvancedLab/05.SmallShop

Jan 24th, 2021
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.56 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp21
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string product = Console.ReadLine();
  10.             string town = Console.ReadLine();
  11.             double quantity = double.Parse(Console.ReadLine());
  12.  
  13.             double price = 0.0;
  14.             if (town == "Sofia")
  15.             {
  16.                 if (product == "coffee")
  17.                 {
  18.                     price = quantity * 0.50;
  19.                 }
  20.                 else if (product == "water")
  21.                 {
  22.                     price = quantity * 0.80;
  23.                 }
  24.                 else if (product == "beer")
  25.                 {
  26.                     price = quantity * 1.20;
  27.                 }
  28.                 else if (product == "sweets")
  29.                 {
  30.                     price = quantity * 1.45;
  31.                 }
  32.                 else if (product == "peanuts")
  33.                 {
  34.                     price = quantity * 1.60;
  35.                 }
  36.                 Console.WriteLine(price);
  37.             }
  38.  
  39.             else if (town == "Plovdiv")
  40.             {
  41.                 if (product == "coffee")
  42.                 {
  43.                     price = quantity * 0.40;
  44.                 }
  45.                 else if (product == "water")
  46.                 {
  47.                     price = quantity * 0.70;
  48.                 }
  49.                 else if (product == "beer")
  50.                 {
  51.                     price = quantity * 1.15;
  52.                 }
  53.                 else if (product == "sweets")
  54.                 {
  55.                     price = quantity * 1.30;
  56.                 }
  57.                 else if (product == "peanuts")
  58.                 {
  59.                     price = quantity * 1.50;
  60.                 }
  61.                 Console.WriteLine(price);
  62.             }
  63.  
  64.             else if (town == "Varna")
  65.             {
  66.                 if (product == "coffee")
  67.                 {
  68.                     price = quantity * 0.45;
  69.                 }
  70.                 else if (product == "water")
  71.                 {
  72.                     price = quantity * 0.70;
  73.                 }
  74.                 else if (product == "beer")
  75.                 {
  76.                     price = quantity * 1.10;
  77.                 }
  78.                 else if (product == "sweets")
  79.                 {
  80.                     price = quantity * 1.35;
  81.                 }
  82.                 else if (product == "peanuts")
  83.                 {
  84.                     price = quantity * 1.55;
  85.                 }
  86.                 Console.WriteLine(price);
  87.             }
  88.  
  89.         }
  90.     }
  91. }
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement