Advertisement
vencinachev

Pizza

Nov 13th, 2021
822
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.89 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 IFelse
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string pizza = Console.ReadLine();
  14.             string desert = Console.ReadLine();
  15.             int brpizza = int.Parse(Console.ReadLine());
  16.             double money = 0.0;
  17.            /* if (pizza == "Small")
  18.             {
  19.                 money = 9.98 * brpizza;
  20.             }
  21.             else if (pizza == "Medium")
  22.             {
  23.                 money = 18.99 * brpizza;
  24.             }
  25.             else if (pizza == "Large")
  26.             {
  27.                 money = 25.98 * brpizza;
  28.             }
  29.             else if (pizza == "ExtraLarge")
  30.             {
  31.                 money = 35.99 * brpizza;
  32.             }*/
  33.  
  34.             switch (pizza)
  35.             {
  36.                 case "Small":
  37.                     money = 9.98 * brpizza;
  38.                     break;
  39.                 case "Medium":
  40.                     money = 18.99 * brpizza;
  41.                     break;
  42.                 case "Large":
  43.                     money = 25.98 * brpizza;
  44.                     break;
  45.                 case "ExtraLarge":
  46.                     money = 35.99 * brpizza;
  47.                     break;
  48.             }
  49.  
  50.             if (desert == "yes")
  51.             {
  52.                 // money = money + 5;
  53.                 money += 5;
  54.                 if (money > 50)
  55.                 {
  56.                     money = money - 0.10 * money;
  57.                 }
  58.                 else if (money > 25)
  59.                 {
  60.                     money = money - 0.07 * money;
  61.                 }
  62.                 else if (money > 15)
  63.                 {
  64.                     money = money - 0.05 * money;
  65.                 }
  66.             }
  67.             Console.WriteLine($"{money:F2} lv.");
  68.  
  69.         }
  70.     }
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement