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 numFishers = int.Parse(Console.ReadLine());
- bool flag = true;
- double boatRent = 0;
- double totalPrice = 0;
- switch (season)
- {
- case "Spring":
- boatRent = 3000;
- break;
- case "Summer":
- boatRent = 4200;
- break;
- case "Autumn":
- boatRent = 4200;
- break;
- case "Winter":
- boatRent = 2600;
- break;
- default:
- flag = false;
- break;
- }
- if (flag)
- {
- if (numFishers <= 6)
- {
- totalPrice = boatRent - 0.1 * boatRent;
- }
- else if (numFishers >= 7 && numFishers <= 11)
- {
- totalPrice = boatRent - 0.15 * boatRent;
- }
- else if (numFishers >= 12)
- {
- totalPrice = boatRent - 0.25 * boatRent;
- }
- if (numFishers % 2 == 0 && season != "Autumn")
- {
- totalPrice = totalPrice - 0.05 * totalPrice;
- }
- if (budget >= totalPrice)
- {
- Console.WriteLine($"Yes! You have {budget - totalPrice:f2} leva left.");
- }
- else
- {
- Console.WriteLine($"Not enough money! You need {totalPrice - budget} leva.");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement