Threed90

03.SushiTime

Oct 28th, 2018
305
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _03.SushiTime
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Dictionary<string, Dictionary<string, double>> sushi = new Dictionary<string, Dictionary<string, double>>();
  11.  
  12.             sushi.Add("Sushi Zone", new Dictionary<string, double>());
  13.             sushi.Add("Sushi Time", new Dictionary<string, double>());
  14.             sushi.Add("Sushi Bar", new Dictionary<string, double>());
  15.             sushi.Add("Asian Pub", new Dictionary<string, double>());
  16.  
  17.             sushi["Sushi Zone"]["sashimi"] = 4.99;
  18.             sushi["Sushi Zone"]["maki"] = 5.29;
  19.             sushi["Sushi Zone"]["uramaki"] = 5.99;
  20.             sushi["Sushi Zone"]["temaki"] = 4.29;
  21.            
  22.             sushi["Sushi Time"]["sashimi"] = 5.49;
  23.             sushi["Sushi Time"]["maki"] = 4.69;
  24.             sushi["Sushi Time"]["uramaki"] = 4.49;
  25.             sushi["Sushi Time"]["temaki"] = 5.19;
  26.            
  27.             sushi["Sushi Bar"]["sashimi"] = 5.25;
  28.             sushi["Sushi Bar"]["maki"] = 5.55;
  29.             sushi["Sushi Bar"]["uramaki"] = 6.25;
  30.             sushi["Sushi Bar"]["temaki"] = 4.75;
  31.            
  32.             sushi["Asian Pub"]["sashimi"] = 4.50;
  33.             sushi["Asian Pub"]["maki"] = 4.80;
  34.             sushi["Asian Pub"]["uramaki"] = 5.50;
  35.             sushi["Asian Pub"]["temaki"] = 5.50;
  36.  
  37.             string sushiType = Console.ReadLine();
  38.             string restaurantName = Console.ReadLine();
  39.             int numberOfPortions = int.Parse(Console.ReadLine());
  40.             char order = char.Parse(Console.ReadLine());
  41.             if(!sushi.ContainsKey(restaurantName))
  42.             {
  43.                 Console.WriteLine($"{restaurantName} is invalid restaurant!");
  44.                 return;
  45.             }
  46.  
  47.             double price = sushi[restaurantName][sushiType] * numberOfPortions;
  48.  
  49.             if(order=='Y')
  50.             {
  51.                 price += (price * 0.2);
  52.             }
  53.  
  54.             Console.WriteLine($"Total price: {Math.Ceiling(price)} lv.");
  55.         }
  56.     }
  57. }
RAW Paste Data