Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine().ToLower();
- string day = Console.ReadLine().ToLower();
- var unit = double.Parse(Console.ReadLine());
- var price = -1.0;
- //Тук в if-a "wednesdy" е сбъркано, трябва да е "wednesday"
- if (day == "monday" || day == "tuesday" || day == "wednesdy" || day == "thursday" || day == "friday")
- {
- if (fruit == "banana")
- {
- price = 2.50;
- }
- else if (fruit == "apple")
- {
- price = 1.20;
- }
- else if (fruit == "orange")
- {
- price = 0.85;
- }
- else if (fruit == "grapefruit")
- {
- price = 1.45;
- }
- else if (fruit == "kiwi")
- {
- price = 2.70;
- }
- else if (fruit == "pineapple")
- {
- price = 5.50;
- }
- else if (fruit == "grapes")
- {
- price = 3.85;
- }
- }
- //Тук в if-a имаш 1 спейс повече в "saturday ", трябва да е "saturday"
- if (day == "saturday " || day == "sunday")
- {
- if (fruit == "banana")
- {
- price = 2.70;
- }
- else if (fruit == "apple")
- {
- price = 1.25;
- }
- else if (fruit == "orange")
- {
- price = 0.90;
- }
- //Тук в else if-a имаш си сбъркал "arapegruit", трябва да е "grapefruit"
- else if (fruit == "arapefruit")
- {
- price = 1.60;
- }
- else if (fruit == "kiwi")
- {
- price = 3.00;
- }
- else if (fruit == "pineapple")
- {
- price = 5.60;
- }
- else if (fruit == "grapes")
- {
- price = 4.20;
- }
- }
- if (price >= 0)
- {
- Console.WriteLine("{0:F2}", price * unit);
- }
- else
- {
- Console.WriteLine("error");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement