Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Fruit_Market
- {
- class FruitMarket
- {
- public static void Main(string[] args)
- {
- string dayOfWeek = Console.ReadLine();
- double quantity1 = double.Parse(Console.ReadLine());
- string product1 = Console.ReadLine();
- double quantity2 = double.Parse(Console.ReadLine());
- string product2 = Console.ReadLine();
- double quantity3 = double.Parse(Console.ReadLine());
- string product3 = Console.ReadLine();
- double banana = 1.8;
- double cucumber = 2.75;
- double tomato = 3.2;
- double orange = 1.6;
- double apple = 0.86;
- double totalPrice = 0;
- double firstProduct = 0;
- double secondProduct = 0;
- double thirdProduct = 0;
- switch (product1)
- {
- case "banana": firstProduct = quantity1 * banana; break;
- case "cucumber": firstProduct = quantity1 * cucumber; break;
- case "tomato": firstProduct = quantity1 * tomato; break;
- case "orange": firstProduct = quantity1 * orange; break;
- case "apple": firstProduct = quantity1 * apple; break;
- }
- switch (product2)
- {
- case "banana": secondProduct = quantity2 * banana; break;
- case "cucumber": secondProduct = quantity2 * cucumber; break;
- case "tomato": secondProduct = quantity2 * tomato; break;
- case "orange": secondProduct = quantity2 * orange; break;
- case "apple": secondProduct = quantity2 * apple; break;
- }
- switch (product3)
- {
- case "banana": thirdProduct = quantity3 * banana; break;
- case "cucumber": thirdProduct = quantity3 * cucumber; break;
- case "tomato": thirdProduct = quantity3 * tomato; break;
- case "orange": thirdProduct = quantity3 * orange; break;
- case "apple": thirdProduct = quantity3 * apple; break;
- }
- totalPrice = firstProduct + secondProduct + thirdProduct;
- if(dayOfWeek == "Friday")
- {
- totalPrice = totalPrice - totalPrice * 0.1;
- Console.WriteLine("{0:0.00}", totalPrice);
- }
- else if(dayOfWeek == "Sunday")
- {
- totalPrice = totalPrice - totalPrice * 0.05;
- Console.WriteLine("{0:0.00}", totalPrice);
- }
- else if(dayOfWeek == "Tuesday")
- {
- switch (product3)
- {
- case "banana": thirdProduct = quantity3 * banana - quantity3 * banana * 0.2;break;
- case "orange": thirdProduct = quantity3 * orange - quantity3 * orange * 0.2; break;
- case "apple": thirdProduct = quantity3 * apple - quantity3 * apple * 0.2; break;
- case "tomato": thirdProduct = quantity3 * tomato; break;
- case "cucumber": thirdProduct = quantity3 * cucumber; break;
- }
- switch (product2)
- {
- case "banana": secondProduct = quantity2 * banana - quantity2 * banana * 0.2; break;
- case "orange": secondProduct = quantity2 * orange - quantity2 * orange * 0.2; break;
- case "apple": secondProduct = quantity2 * apple - quantity2 * apple * 0.2; break;
- case "tomato": secondProduct = quantity2 * tomato; break;
- case "cucumber": secondProduct = quantity2 * cucumber; break;
- }
- switch (product1)
- {
- case "banana": firstProduct = quantity1 * banana - quantity1 * banana * 0.2; break;
- case "orange": firstProduct = quantity1 * orange - quantity1 * orange * 0.2; break;
- case "apple": firstProduct = quantity1 * apple - quantity1 * apple * 0.2; break;
- case "tomato": firstProduct = quantity1 * tomato; break;
- case "cucumber": firstProduct = quantity1 * cucumber; break;
- }
- totalPrice = firstProduct + secondProduct + thirdProduct;
- Console.WriteLine("{0:0.00}", totalPrice);
- }
- else if (dayOfWeek == "Wednesday")
- {
- switch (product1)
- {
- case "banana": firstProduct = quantity1 * banana; break;
- case "cucumber": firstProduct = quantity1 * cucumber - quantity1 * cucumber * 0.1; break;
- case "tomato": firstProduct = quantity1 * tomato - quantity1 * tomato * 0.1; break;
- case "orange": firstProduct = quantity1 * orange; break;
- case "apple": firstProduct = quantity1 * apple; break;
- }
- switch (product2)
- {
- case "banana": secondProduct = quantity2 * banana; break;
- case "cucumber": secondProduct = quantity2 * cucumber - quantity2 * cucumber * 0.1; break;
- case "tomato": secondProduct = quantity2 * tomato - quantity2 * tomato * 0.1; break;
- case "orange": secondProduct = quantity2 * orange; break;
- case "apple": secondProduct = quantity2 * apple; break;
- }
- switch (product3)
- {
- case "banana": thirdProduct = quantity3 * banana; break;
- case "cucumber": thirdProduct = quantity3 * cucumber - quantity3 * cucumber * 0.1; break;
- case "tomato": thirdProduct = quantity3 * tomato - quantity3 * tomato * 0.1; break;
- case "orange": thirdProduct = quantity3 * orange; break;
- case "apple": thirdProduct = quantity3 * apple; break;
- }
- totalPrice = firstProduct + secondProduct + thirdProduct;
- Console.WriteLine("{0:0.00}", totalPrice);
- }
- else if (dayOfWeek == "Thursday")
- {
- switch (product1)
- {
- case "banana": firstProduct = quantity1 * banana - quantity1 * banana * 0.3; break;
- case "cucumber": firstProduct = quantity1 * cucumber; break;
- case "tomato": firstProduct = quantity1 * tomato; break;
- case "orange": firstProduct = quantity1 * orange; break;
- case "apple": firstProduct = quantity1 * apple; break;
- }
- switch (product2)
- {
- case "banana": secondProduct = quantity2 * banana - quantity2 * banana * 0.3; break;
- case "cucumber": secondProduct = quantity2 * cucumber; break;
- case "tomato": secondProduct = quantity2 * tomato; break;
- case "orange": secondProduct = quantity2 * orange; break;
- case "apple": secondProduct = quantity2 * apple; break;
- }
- switch (product3)
- {
- case "banana": thirdProduct = quantity3 * banana - quantity3 * banana * 0.3; break;
- case "cucumber": thirdProduct = quantity3 * cucumber; break;
- case "tomato": thirdProduct = quantity3 * tomato; break;
- case "orange": thirdProduct = quantity3 * orange; break;
- case "apple": thirdProduct = quantity3 * apple; break;
- }
- totalPrice = firstProduct + secondProduct + thirdProduct;
- Console.WriteLine("{0:0.00}", totalPrice);
- }
- else
- {
- Console.WriteLine("{0:0.00}", totalPrice);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment