grigorb57

Small shop

Jan 30th, 2018
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.15 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp15
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string product =
  14.                 Console.ReadLine().ToLower();
  15.             string town =
  16.                 Console.ReadLine().ToLower();
  17.  
  18.             double quantity = double.Parse(
  19.                 Console.ReadLine());
  20.  
  21.             if(town == "sofia")
  22.             {
  23.                 if(product =="coffee")
  24.                     Console.WriteLine(0.50 * quantity);
  25.                 else if(product =="water")
  26.                     Console.WriteLine(0.80 * quantity);
  27.                 else if(product =="beer")
  28.                     Console.WriteLine(1.20 * quantity);
  29.                 else if(product =="sweets")
  30.                     Console.WriteLine(1.45 * quantity);
  31.                 else if(product == "peanuts")
  32.                     Console.WriteLine(1.60 * quantity);
  33.             }
  34.             if(town == "plovdiv")
  35.             {
  36.                 if(product == "coffee")
  37.                     Console.WriteLine(quantity * 0.40);
  38.                 else if(product =="water")
  39.                     Console.WriteLine(quantity * 0.70);
  40.                 else if(product == "beer")
  41.                     Console.WriteLine(quantity * 1.15);
  42.                 else if(product == "sweets")
  43.                     Console.WriteLine(quantity * 1.30);
  44.                 else if(product == "peanuts")
  45.                     Console.WriteLine(quantity * 1.50);
  46.             }
  47.             if (town == "varna")
  48.             {
  49.                 if(product == "coffee")
  50.                     Console.WriteLine(quantity * 0.45);
  51.                 else if(product == "water")
  52.                     Console.WriteLine(quantity * 0.70);
  53.                 else if(product == "beer")
  54.                     Console.WriteLine(quantity * 1.10);
  55.                 else if(product == "sweets")
  56.                     Console.WriteLine(quantity * 1.35);
  57.                 else if(product == "peanuts")
  58.                     Console.WriteLine(quantity * 1.55);
  59.             }
  60.         }
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment