VelizarAvramov

02. Small Shop

Mar 21st, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.11 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 smalShopTwo
  8. {
  9.     class smallShopTwo
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             var product = Console.ReadLine();
  14.             var town = Console.ReadLine();
  15.             var quantity = double.Parse(Console.ReadLine());
  16.  
  17.             if (town == "Sofia")
  18.             {
  19.                 if (product == "coffee")
  20.                 {
  21.                     Console.WriteLine(quantity * 0.50);
  22.                 }
  23.                 else if (product == "water")
  24.                 {
  25.                     Console.WriteLine(quantity * 0.80);
  26.                 }
  27.                 else if (product == "beer")
  28.                 {
  29.                     Console.WriteLine(quantity * 1.20);
  30.                 }
  31.                 else if (product == "sweets")
  32.                 {
  33.                     Console.WriteLine(quantity * 1.45);
  34.                 }
  35.                 else if (product == "peanuts")
  36.                 {
  37.                     Console.WriteLine(quantity * 1.60);
  38.                 }
  39.                 else
  40.                 {
  41.                     Console.WriteLine("Invalid product");
  42.                 }
  43.             }
  44.             else if (town == "Plovdiv")
  45.             {
  46.                 if (product == "coffee")
  47.                 {
  48.                     Console.WriteLine(quantity * 0.40);
  49.                 }
  50.                 else if (product == "water")
  51.                 {
  52.                     Console.WriteLine(quantity * 0.70);
  53.                 }
  54.                 else if (product == "beer")
  55.                 {
  56.                     Console.WriteLine(quantity * 1.15);
  57.                 }
  58.                 else if (product == "sweets")
  59.                 {
  60.                     Console.WriteLine(quantity * 1.30);
  61.                 }
  62.                 else if (product == "peanuts")
  63.                 {
  64.                     Console.WriteLine(quantity * 1.50);
  65.                 }
  66.                 else
  67.                 {
  68.                     Console.WriteLine("Invalid product");
  69.                 }
  70.             }
  71.             else if (town == "Varna")
  72.             {
  73.                 if (product == "coffee")
  74.                 {
  75.                     Console.WriteLine(quantity * 0.45);
  76.                 }
  77.                 else if (product == "water")
  78.                 {
  79.                     Console.WriteLine(quantity * 0.70);
  80.                 }
  81.                 else if (product == "beer")
  82.                 {
  83.                     Console.WriteLine(quantity * 1.10);
  84.                 }
  85.                 else if (product == "sweets")
  86.                 {
  87.                     Console.WriteLine(quantity * 1.35);
  88.                 }
  89.                 else if (product == "peanuts")
  90.                 {
  91.                     Console.WriteLine(quantity * 1.55);
  92.                 }
  93.                 else
  94.                 {
  95.                     Console.WriteLine("Invalid product");
  96.                 }
  97.             }
  98.             else
  99.             {
  100.                 Console.WriteLine("Invalid town");
  101.             }
  102.  
  103.         }
  104.     }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment