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