Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _7_ma
- {
- class Program
- {
- static void Main(string[] args)
- {
- string fruit = Console.ReadLine().ToLower();
- string day = Console.ReadLine().ToLower();
- double amount = double.Parse(Console.ReadLine());
- double price = 0.00;
- if (day == "monday" || day == "tuesday" || day == "wednesday" || day == "thursday" || day == "friday") //провека на деня
- {
- if (fruit == "banana") // провека на плод
- {
- price = amount * 2.5; // промяна на цена ако се изпълни
- }
- else if (fruit == "apple")
- {
- price = amount * 1.20;
- }
- else if (fruit == "orange")
- {
- price = amount * 0.85;
- }
- else if (fruit == "grapefruit")
- {
- price = amount * 1.45;
- }
- else if (fruit == "kiwi")
- {
- price = amount * 2.70;
- }
- else if (fruit == "pineapple")
- {
- price = amount * 5.50;
- }
- else if (fruit == "grapes")
- {
- price = amount * 3.85;
- }
- else
- {
- Console.WriteLine("error"); // да се изпише ерор ако е въведен плод различен от посочените в иф-а
- }
- }
- else if (day == "saturday" || day == "sunday")
- {
- if (fruit == "banana")
- {
- price = amount * 2.7;
- }
- else if (fruit == "apple")
- {
- price = amount * 1.25;
- }
- else if (fruit == "orange")
- {
- price = amount * 0.90;
- }
- else if (fruit == "grapefruit")
- {
- price = amount * 1.60;
- }
- else if (fruit == "kiwi")
- {
- price = amount * 3.00;
- }
- else if (fruit == "pineapple")
- {
- price = amount * 5.60;
- }
- else if (fruit == "grapes")
- {
- price = amount * 4.20;
- }
- else
- {
- Console.WriteLine("error"); // да се изпише ерор ако е въведен плод различен от посочените в иф-а
- }
- }
- else
- {
- Console.WriteLine("error"); //// да се изпише ерор ако е въведен ден различен от посочените в иф-а
- }
- if (price==0) // проверка ако цената е 0 , да не се изпълнява нищо
- {
- }
- else // но ако цената е различна от 0 да се отпечата
- {
- Console.WriteLine("{0:F2}", price);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement