Advertisement
Guest User

03. Energy Booster

a guest
Aug 1st, 2020
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.98 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _3.EnergyBooster
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string fruit = Console.ReadLine();
  10.             string size = Console.ReadLine();
  11.             int sets = int.Parse(Console.ReadLine());
  12.  
  13.             double price = 0;
  14.             double totalPrice = 0;
  15.  
  16.             switch (fruit)
  17.             {
  18.                 case "Watermelon":
  19.                     if (size == "small")
  20.                     {
  21.                         price = 2 * 56.00;
  22.                     }
  23.                     else
  24.                     {
  25.                         price = 5 * 28.70;
  26.                     }
  27.                     break;
  28.                 case "Mango":
  29.                     if (size == "small")
  30.                     {
  31.                         price = 2 * 36.66;
  32.                     }
  33.                     else
  34.                     {
  35.                         price = 5 * 19.60;
  36.                     }
  37.                     break;
  38.                 case "Pineapple":
  39.                     if (size == "small")
  40.                     {
  41.                         price = 2 * 42.10;
  42.                     }
  43.                     else
  44.                     {
  45.                         price = 5 * 24.80;
  46.                     }
  47.                     break;
  48.                 case "Raspberry":
  49.                     if (size == "small")
  50.                     {
  51.                         price = 2 * 20.00;
  52.                     }
  53.                     else
  54.                     {
  55.                         price = 5 * 15.20;
  56.                     }
  57.                     break;
  58.             }
  59.  
  60.             totalPrice = sets * price;
  61.  
  62.             if (totalPrice > 400 && totalPrice <= 1000)
  63.             {
  64.                 totalPrice -= totalPrice * 0.15;
  65.             }
  66.             else if (totalPrice > 1000)
  67.             {
  68.                 totalPrice -= totalPrice * 0.50;
  69.             }
  70.  
  71.             Console.WriteLine($"{totalPrice:f2} lv.");
  72.         }
  73.     }
  74. }
  75.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement