SvetlanPetrova

Sushi Time SoftUni

Apr 6th, 2019 (edited)
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.67 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SushiTime
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string sushiType = Console.ReadLine();
  10.             string restaurantName = Console.ReadLine();
  11.             int portionsNumber = int.Parse(Console.ReadLine());
  12.             char delivery = char.Parse(Console.ReadLine());
  13.             double price = 0;
  14.             double totalPrice = 0;
  15.  
  16.             switch (restaurantName)
  17.             {
  18.                 case "Sushi Zone":
  19.                     if (sushiType == "sashimi")
  20.                     {
  21.                         price = portionsNumber * 4.99;
  22.                     }
  23.                     else if (sushiType == "maki")
  24.                     {
  25.                         price = portionsNumber * 5.29;
  26.                     }
  27.                     else if (sushiType == "uramaki")
  28.                     {
  29.                         price = portionsNumber * 5.99;
  30.                     }
  31.                     else if (sushiType == "temaki")
  32.                     {
  33.                         price = portionsNumber * 4.29;
  34.                     }
  35.                     break;
  36.                    
  37.                 case "Sushi Time":
  38.                     if (sushiType == "sashimi")
  39.                     {
  40.                         price = portionsNumber * 5.49;
  41.                     }
  42.                     else if (sushiType == "maki")
  43.                     {
  44.                         price = portionsNumber * 4.69;
  45.                     }
  46.                     else if (sushiType == "uramaki")
  47.                     {
  48.                         price = portionsNumber * 4.49;
  49.                     }
  50.                     else if (sushiType == "temaki")
  51.                     {
  52.                         price = portionsNumber * 5.19;
  53.                     }
  54.                     break;
  55.  
  56.                 case "Sushi Bar":
  57.                     if (sushiType == "sashimi")
  58.                     {
  59.                         price = portionsNumber * 5.25;
  60.                     }
  61.                     else if (sushiType == "maki")
  62.                     {
  63.                         price = portionsNumber * 5.55;
  64.                     }
  65.                     else if (sushiType == "uramaki")
  66.                     {
  67.                         price = portionsNumber * 6.25;
  68.                     }
  69.                     else if (sushiType == "temaki")
  70.                     {
  71.                         price = portionsNumber * 4.75;
  72.                     }
  73.                     break;
  74.                 case "Asian Pub":
  75.                     if (sushiType == "sashimi")
  76.                     {
  77.                         price = portionsNumber * 4.50;
  78.                     }
  79.                     else if (sushiType == "maki")
  80.                     {
  81.                         price = portionsNumber * 4.80;
  82.                     }
  83.                     else if (sushiType == "uramaki")
  84.                     {
  85.                         price = portionsNumber * 5.50;
  86.                     }
  87.                     else if (sushiType == "temaki")
  88.                     {
  89.                         price = portionsNumber * 5.50;
  90.                     }
  91.                     break;
  92.                    
  93.                         default:
  94.                             Console.WriteLine($"{restaurantName} is invalid restaurant!");
  95.                             return;
  96.                     }
  97.  
  98.  
  99.             if (delivery == 'Y')
  100.             {
  101.                 totalPrice = Math.Ceiling(price * 1.20);
  102.             }
  103.             else if (delivery == 'N')
  104.             {
  105.                 totalPrice = Math.Ceiling(price);
  106.             }
  107.  
  108.             Console.WriteLine($"Total price: {totalPrice} lv.");
  109.         }
  110.     }
  111. }
Add Comment
Please, Sign In to add comment