Advertisement
j0nze

fruit shop

Oct 19th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.75 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 _7_Fruit_Shop
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string product = Console.ReadLine().ToLower();
  14.             string day = Console.ReadLine().ToLower();
  15.             double amount = double.Parse(Console.ReadLine());
  16.  
  17.             double price = 0.0;
  18.  
  19.             if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thursday" || day == "friday")
  20.             {
  21.                 if (product == "banana")
  22.                 {
  23.                     price = amount * 2.5;
  24.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  25.                 }
  26.                 else if (product == "apple")
  27.                 {
  28.                     price = amount * 1.2;
  29.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  30.                 }
  31.                 else if (product == "orange")
  32.                 {
  33.                     price = amount * 0.85;
  34.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  35.                 }
  36.                 else if (product == "grapefruit")
  37.                 {
  38.                     price = amount * 1.45;
  39.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  40.                 }
  41.                 else if (product == "kiwi")
  42.                 {
  43.                     price = amount * 2.7;
  44.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  45.                 }
  46.                 else if (product == "pineapple")
  47.                 {
  48.                     price = amount * 5.5;
  49.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  50.                 }
  51.                 else if (product == "grapes")
  52.                 {
  53.                     price = amount * 3.85;
  54.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  55.                 }
  56.                 else
  57.                 {
  58.                     Console.WriteLine("error");
  59.                 }
  60.  
  61.             }
  62.  
  63.             else if (day == "saturday" || day == "sunday")
  64.             {
  65.                 if (product == "banana")
  66.                 {
  67.                     price = amount * 2.7;
  68.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  69.                 }
  70.                 else if (product == "apple")
  71.                 {
  72.                     price = amount * 1.25;
  73.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  74.                 }
  75.                 else if (product == "orange")
  76.                 {
  77.                     price = amount * 0.9;
  78.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  79.                 }
  80.                 else if (product == "grapefruit")
  81.                 {
  82.                     price = amount * 1.6;
  83.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  84.                 }
  85.                 else if (product == "kiwi")
  86.                 {
  87.                     price = amount * 3.0;
  88.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  89.                 }
  90.                 else if (product == "pineapple")
  91.                 {
  92.                     price = amount * 5.6;
  93.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  94.                 }
  95.                 else if (product == "grapes")
  96.                 {
  97.                     price = amount * 4.2;
  98.                     Console.WriteLine("{0:0.00}", Math.Round(price, 2));
  99.                 }
  100.                 else
  101.                 {
  102.                     Console.WriteLine("error");
  103.                 }
  104.             }
  105.             else
  106.             {
  107.                 Console.WriteLine("error");
  108.             }
  109.         }
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement