Advertisement
Guest User

Softuni: Small Shop C#

a guest
Jan 25th, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.02 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 Times_15
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.  
  14.             string product = Console.ReadLine().ToLower();
  15.             string town = Console.ReadLine().ToLower();
  16.             double product_quantity = double.Parse(Console.ReadLine());
  17.  
  18.             Dictionary<string, double>
  19.  
  20.                 sofia = new Dictionary<string, double>()
  21.  
  22.                     {
  23.                         {"coffee", 0.50},
  24.                         {"water", 0.80},
  25.                         {"beer", 1.20},
  26.                         {"sweets", 1.45},
  27.                         {"peanuts", 1.60}
  28.                     },
  29.                
  30.                 varna = new Dictionary<string, double>()
  31.  
  32.                     {
  33.                         {"coffee", 0.45},
  34.                         {"water", 0.70},
  35.                         {"beer", 1.10},
  36.                         {"sweets", 1.35},
  37.                         {"peanuts", 1.55}
  38.                     },
  39.                
  40.                 plovdiv = new Dictionary<string, double>()
  41.  
  42.                     {
  43.                         {"coffee", 0.40},
  44.                         {"water", 0.70},
  45.                         {"beer", 1.15},
  46.                         {"sweets", 1.30},
  47.                         {"peanuts", 1.50}
  48.                     };
  49.  
  50.  
  51.  
  52.             if (town == "sofia")
  53.            
  54.             {
  55.                 double calc_price = (product_quantity * sofia[product]);
  56.                 Console.WriteLine(calc_price);
  57.             }
  58.  
  59.             else if (town == "varna")
  60.             {
  61.                 double calc_price = (product_quantity * varna[product]);
  62.                 Console.WriteLine(calc_price);
  63.             }
  64.  
  65.             else if (town == "plovdiv")
  66.             {
  67.                 double calc_price = (product_quantity * plovdiv[product]);
  68.                 Console.WriteLine(calc_price);
  69.             }
  70.  
  71.         }
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement