Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.ComponentModel.Design;
- using System.Globalization;
- using System.Reflection;
- using System.Runtime.ConstrainedExecution;
- using System.Security.Cryptography;
- namespace SomeExcercises
- {
- class Program
- {
- static void Main(string[] args)
- {
- // Напишете програма, която чете от конзолата плод (banana / apple / orange / grapefruit / kiwi /
- //pineapple / grapes), ден от седмицата (Monday / Tuesday / Wednesday / Thursday / Friday /
- //Saturday / Sunday) и количес;тво (реално число)
- double finalPrice = 0.0;
- string fruit = Console.ReadLine();
- string dayOfWeek = Console.ReadLine();
- double quantity = double.Parse(Console.ReadLine());
- if (dayOfWeek == "Monday" || dayOfWeek == "Tuesday" || dayOfWeek=="Wednesday" || dayOfWeek=="Thursday" || dayOfWeek == "Friday")
- {
- switch (fruit)
- {
- case "banana":
- finalPrice = quantity * 2.50;
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "apple":
- finalPrice = (quantity * 1.20);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "orange":
- finalPrice = (quantity * 0.85);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "grapefruit":
- finalPrice = (quantity * 1.45);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "kiwi":
- finalPrice = (quantity * 2.70);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "pineapple":
- finalPrice = (quantity * 5.50);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "grapes":
- finalPrice = (quantity * 3.85);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- default:
- Console.WriteLine("error");
- break;
- }
- }
- else if (dayOfWeek == "Saturday" || dayOfWeek == "Sunday")
- {
- switch (fruit)
- {
- case "banana":
- finalPrice = (quantity * 2.70);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "apple":
- finalPrice = (quantity * 1.25);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "orange":
- finalPrice = (quantity * 0.90);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "grapefruit":
- finalPrice = (quantity * 1.60);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "kiwi":
- finalPrice = (quantity * 3.00);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "pineapple":
- finalPrice = (quantity * 5.60);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- case "grapes":
- finalPrice = (quantity * 4.20);
- Console.WriteLine($"{finalPrice:f2}");
- break;
- default:
- Console.WriteLine("error");
- break;
- }
- }
- if (dayOfWeek != "Monday" && dayOfWeek != "Tuesday" && dayOfWeek != "Wednesday" && dayOfWeek != "Thursday" && dayOfWeek != "Friday" && dayOfWeek != "Saturday" && dayOfWeek != "Sunday")
- {
- Console.WriteLine("error");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment