Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Conditional_Statements_Advanced_5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int budget = int.Parse(Console.ReadLine());
- string seson = Console.ReadLine();
- int fisherman = int.Parse(Console.ReadLine());
- double price = 0;
- double discount = 0;;
- switch (seson)
- {
- case "Spring":
- price = 3000;
- break;
- case "Summer":
- price = 4200;
- break;
- case "Autumn":
- price = 4200;
- break;
- case "Winter":
- price = 2600;
- break;
- }
- if (fisherman <= 6)
- {
- if (fisherman % 2 == 0)
- {
- discount = ((price * 15) / 100);
- }
- else
- {
- discount = price * 0.10;
- }
- }
- else if (fisherman >= 7 && fisherman <= 11)
- {
- if (fisherman % 2 == 0)
- {
- discount = ((price * 20) / 100);
- }
- else
- {
- discount = price * 0.15;
- }
- }
- else if (fisherman >= 12)
- {
- if (fisherman % 2 == 0)
- {
- discount = ((price * 30) / 100);
- }
- else
- {
- discount = price * 0.25;
- }
- }
- double budgetLeft = (budget + discount) - price;
- double moneyNeed = price - (budget + discount);
- if (price < budget+ discount)
- {
- Console.WriteLine($"Yes! You have {budgetLeft:f2} leva left.");
- }
- else if (price>budgetLeft)
- {
- Console.WriteLine($"Not enough money! You need {moneyNeed:f2} leva.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement