Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp8
- {
- class Program
- {
- static void Main(string[] args)
- {
- double priceForSpring = 3000;
- double priceForSummerAndAutumn = 4200;
- double priceForWinter = 2600;
- int budget = int.Parse(Console.ReadLine());
- string season = Console.ReadLine();
- int countOfFisherman = int.Parse(Console.ReadLine());
- double totalMoney = 0;
- switch (season)
- {
- case "Winter":
- totalMoney = priceForWinter;
- break;
- case "Spring":
- totalMoney = priceForSpring;
- break;
- case "Summer":
- totalMoney = priceForSummerAndAutumn;
- break;
- case "Autumn":
- totalMoney = priceForSummerAndAutumn;
- break;
- }
- if (countOfFisherman <= 6)
- {
- totalMoney = totalMoney - (totalMoney * 0.10);
- }
- else if (countOfFisherman >= 7 && countOfFisherman <= 11)
- {
- totalMoney = totalMoney - (totalMoney * 0.15);
- }
- else if (countOfFisherman >= 12)
- {
- totalMoney = totalMoney - (totalMoney * 0.25);
- }
- if (countOfFisherman % 2 == 0 && season != "Autumn")
- {
- totalMoney = totalMoney - (totalMoney * 0.05);
- }
- if (budget >= totalMoney)
- {
- double moneyLeft = budget - totalMoney;
- Console.WriteLine($"Yes! You have {moneyLeft:f2} leva left.");
- }
- else if (budget < totalMoney)
- {
- double moneyNeeded = totalMoney - budget;
- Console.WriteLine($"Not enough money! You need {moneyNeeded:f2} leva.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement