Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace FruitShop
- {
- using System;
- class FruitShop
- {
- static void Main()
- {
- var fruit = Console.ReadLine().ToLower();
- var day = Console.ReadLine().ToLower();
- var qty = double.Parse(Console.ReadLine());
- var price = 0.0;
- if (!(day == "monday" || day == "tuesday" || day == "wednesday" || day == "thursday" || day == "friday" || day == "saturday" || day == "sunday"))
- {
- Console.WriteLine("error");
- return;
- }
- if (!(fruit == "banana" || fruit == "apple" || fruit == "orange" || fruit == "grapefruit" || fruit == "kiwi" || fruit == "pineapple" || fruit == "grapes"))
- {
- Console.WriteLine("error");
- return;
- }
- if (day == "saturday" || day == "sunday")
- {
- if (fruit == "banana")
- {
- price = 2.70;
- }
- 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.0;
- }
- else if (fruit == "pineapple")
- {
- price = 5.6;
- }
- else if (fruit == "grapes")
- {
- price = 4.2;
- }
- }
- else
- {
- 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;
- }
- }
- Console.WriteLine(Math.Round(price * qty, 2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement