Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2018
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.54 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 ConsoleApp48
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string fruit = Console.ReadLine();
  14.             string weekDay = Console.ReadLine();
  15.             double quantity = double.Parse(Console.ReadLine());
  16.             double price = 0;
  17.  
  18.             if (weekDay == "Monday" || weekDay == "Tuesday" || weekDay == "Wednesday" || weekDay == "Thursday" || weekDay == "Friday")
  19.             {
  20.                 if (fruit == "banana")
  21.                 {
  22.                     price = quantity * 2.50;
  23.                     Console.WriteLine("{0:f2}", price);
  24.                 }
  25.                 else if (fruit == "apple")
  26.                 {
  27.                     price = quantity * 1.20;
  28.                     Console.WriteLine("{0:f2}", price);
  29.                 }
  30.                 else if (fruit == "orange")
  31.                 {
  32.                     price = quantity * 0.85;
  33.                     Console.WriteLine("{0:f2}", price);
  34.                 }
  35.                 else if (fruit == "grapefruit")
  36.                 {
  37.                     price = quantity * 1.45;
  38.                     Console.WriteLine("{0:f2}", price);
  39.                 }
  40.                 else if (fruit == "kiwi")
  41.                 {
  42.                     price = quantity * 2.70;
  43.                     Console.WriteLine("{0:f2}", price);
  44.                 }
  45.                 else if (fruit == "pineapple")
  46.                 {
  47.                     price = quantity * 5.50;
  48.                     Console.WriteLine("{0:f2}", price);
  49.                 }
  50.                 else if (fruit == "grapes")
  51.                 {
  52.                     price = quantity * 3.85;
  53.                     Console.WriteLine("{0:f2}", price);
  54.                 }
  55.                 else
  56.                 {
  57.                     Console.WriteLine("error");
  58.                 }
  59.             }
  60.             else if (weekDay == "Saturday" || weekDay == "Sunday")
  61.             {
  62.                 if (fruit == "banana")
  63.                 {
  64.                     price = quantity * 2.70;
  65.                     Console.WriteLine("{0:f2}", price);
  66.                 }
  67.                 else if (fruit == "apple")
  68.                 {
  69.                     price = quantity * 1.25;
  70.                     Console.WriteLine("{0:f2}", price);
  71.                 }
  72.                 else if (fruit == "orange")
  73.                 {
  74.                     price = quantity * 0.90;
  75.                     Console.WriteLine("{0:f2}", price);
  76.                 }
  77.                 else if (fruit == "grapefruit")
  78.                 {
  79.                     price = quantity * 1.60;
  80.                     Console.WriteLine("{0:f2}", price);
  81.                 }
  82.                 else if (fruit == "kiwi")
  83.                 {
  84.                     price = quantity * 3.00;
  85.                     Console.WriteLine("{0:f2}", price);
  86.                 }
  87.                 else if (fruit == "pineapple")
  88.                 {
  89.                     price = quantity * 5.60;
  90.                     Console.WriteLine("{0:f2}", price);
  91.                 }
  92.                 else if (fruit == "grapes")
  93.                 {
  94.                     price = quantity * 4.20;
  95.                     Console.WriteLine("{0:f2}", price);
  96.                 }
  97.                 else
  98.                 {
  99.                     Console.WriteLine("error");
  100.                 }
  101.             }
  102.             else
  103.             {
  104.                 Console.WriteLine("error");
  105.             }
  106.         }
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement