Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace homeworkconditional
- {
- class Program
- {
- static void Main(string[] args)
- {
- int budget = int.Parse(Console.ReadLine());
- string season = Console.ReadLine();
- int fishermanCount = int.Parse(Console.ReadLine());
- var boatRent = 0.0;
- if (season == "Spring")
- {
- boatRent = 3000.0;
- if (fishermanCount <= 6)
- {
- boatRent *= 0.90;
- }
- else if (fishermanCount <= 11)
- {
- boatRent *= 0.85;
- }
- else
- {
- boatRent *= 0.75;
- }
- }
- else if (season == "Summer" || season == "Autumn")
- {
- boatRent = 4200.0;
- if (fishermanCount <= 6)
- {
- boatRent *= 0.90;
- }
- else if (fishermanCount <= 11)
- {
- boatRent *= 0.85;
- }
- else
- {
- boatRent *= 0.75;
- }
- }
- else
- {
- boatRent = 2600.0;
- if (fishermanCount <= 6)
- {
- boatRent *= 0.90;
- }
- else if (fishermanCount <= 11)
- {
- boatRent *= 0.85;
- }
- else
- {
- boatRent *= 0.75;
- }
- }
- if (fishermanCount % 2 == 0 && season != "Autumn")
- {
- boatRent *= 0.95;
- }
- double moneyLeft = budget - boatRent;
- if (moneyLeft >= 0)
- {
- Console.WriteLine($"Yes! You have {moneyLeft:f2} leva left.");
- }
- else
- {
- Console.WriteLine($"Not enough money! You need {(moneyLeft * -1):F2} leva.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement