Advertisement
simonradev

FixedFruitShop

May 22nd, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.43 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Statements
  4. {
  5.     class MainClass
  6.     {
  7.         public static void Main(string[] args)
  8.         {
  9.             string fruit = Console.ReadLine().ToLower();
  10.             string day = Console.ReadLine().ToLower();
  11.             var ammount = double.Parse(Console.ReadLine());
  12.             double total = 0;
  13.  
  14.             if (fruit == "banana")
  15.             {
  16.                 if (day != "sunday" && day != "saturday")
  17.                 {
  18.                     total = ammount * 2.50;
  19.                     Console.WriteLine(Math.Round(total, 2));
  20.                 }
  21.                 else
  22.                 {
  23.                     total = ammount * 2.70;
  24.                     Console.WriteLine(Math.Round(total, 2));
  25.                 }
  26.             }
  27.             if (fruit == "apple")
  28.             {
  29.                 if (day != "sunday" && day != "saturday")
  30.                 {
  31.                     total = ammount * 1.20;
  32.                     Console.WriteLine(Math.Round(total, 2));
  33.                 }
  34.                 else
  35.                 {
  36.                     total = ammount * 1.25;
  37.                     Console.WriteLine(Math.Round(total, 2));
  38.                 }
  39.             }
  40.             if (fruit == "orange")
  41.             {
  42.                 if (day != "sunday" && day != "saturday")
  43.                 {
  44.                     total = ammount * 0.85;
  45.                     Console.WriteLine(Math.Round(total, 2));
  46.                 }
  47.                 else
  48.                 {
  49.                     total = ammount * 0.90;
  50.                     Console.WriteLine(Math.Round(total, 2));
  51.                 }
  52.             }
  53.             if (fruit == "grapefruit")
  54.             {
  55.                 if (day != "sunday" && day != "saturday")
  56.                 {
  57.                     total = ammount * 1.45;
  58.                     Console.WriteLine(Math.Round(total, 2));
  59.                 }
  60.                 else
  61.                 {
  62.                     total = ammount * 1.60;
  63.                     Console.WriteLine(Math.Round(total, 2));
  64.                 }
  65.             }
  66.             if (fruit == "kiwi")
  67.             {
  68.                 if (day != "sunday" && day != "saturday")
  69.                 {
  70.                     total = ammount * 2.70;
  71.                     Console.WriteLine(Math.Round(total, 2));
  72.                 }
  73.                 else
  74.                 {
  75.                     total = ammount * 3.00;
  76.                     Console.WriteLine(Math.Round(total, 2));
  77.                 }
  78.             }
  79.             if (fruit == "pineapple")
  80.             {
  81.                 if (day != "sunday" && day != "saturday")
  82.                 {
  83.                     total = ammount * 5.50;
  84.                     Console.WriteLine(Math.Round(total, 2));
  85.                 }
  86.                 else
  87.                 {
  88.                     total = ammount * 5.60;
  89.                     Console.WriteLine(Math.Round(total, 2));
  90.                 }
  91.             }
  92.             if (fruit == "grapes")
  93.             {
  94.                 if (day != "sunday" && day != "saturday")
  95.                 {
  96.                     total = ammount * 3.85;
  97.                     Console.WriteLine(Math.Round(total, 2));
  98.                 }
  99.                 else
  100.                 {
  101.                     total = ammount * 4.20;
  102.                     Console.WriteLine(Math.Round(total, 2));
  103.                 }
  104.             }
  105.  
  106.             else
  107.             {
  108.                 Console.WriteLine("error");
  109.             }
  110.  
  111.         }
  112.     }
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement