MiroslavKisov

Fruit_Shop

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