Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _08._Fruit_Shop
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine();
- string day = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- double price = 0;
- double totalPrice = 0;
- switch (day)
- {
- case "Monday":
- case "Tuesday":
- case "Wednesday":
- case "Thursday":
- case "Friday":
- if (fruit == "banana")
- {
- price = 2.5;
- }
- else if (fruit == "apple")
- {
- price = 1.2;
- }
- else if (fruit == "orange")
- {
- price = 0.85;
- }
- else if (fruit == "grapefruit")
- {
- price = 1.45;
- }
- else if (fruit == "kiwi")
- {
- price = 2.7;
- }
- else if (fruit == "pineapple")
- {
- price = 5.5;
- }
- else if (fruit == "grapes")
- {
- price = 3.85;
- }
- else
- {
- Console.WriteLine("error");
- }
- if (price != 0)
- {
- totalPrice = price * quantity;
- Console.WriteLine($"{totalPrice:f2}");
- }
- break;
- case "Saturday":
- case "Sunday":
- if (fruit == "banana")
- {
- price = 2.7;
- }
- else if (fruit == "apple")
- {
- price = 1.25;
- }
- else if (fruit == "orange")
- {
- price = 0.9;
- }
- else if (fruit == "grapefruit")
- {
- price = 1.6;
- }
- else if (fruit == "kiwi")
- {
- price = 3;
- }
- else if (fruit == "pineapple")
- {
- price = 5.6;
- }
- else if (fruit == "grapes")
- {
- price = 4.2;
- }
- else
- {
- Console.WriteLine("error");
- }
- if (price != 0)
- {
- totalPrice = price * quantity;
- Console.WriteLine($"{totalPrice:f2}");
- }
- break;
- default:
- Console.WriteLine("error");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement