Fishing Boat - Помощ
Когато предам задачата имам оценка 93/100 и не мога да намеря къде може да ми е грешката.
using System;
namespace Fishing_Boat
{
internal class Program
{
static void Main(string[] args)
{
int budget = int.Parse(Console.ReadLine());
string season = Console.ReadLine();
int fishermen = int.Parse(Console.ReadLine());
int rent;
double price;
switch (season)
{
case "Spring":
rent = 3000;
if (fishermen <= 6)
{
price = rent - rent * 0.1;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
else if (fishermen > 6 && fishermen <= 11)
{
price = rent - rent * 0.15;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
else if (fishermen >= 12)
{
price = rent - rent * 0.25;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
break;
case "Summer":
rent = 4200;
if (fishermen <= 6)
{
price = rent - rent * 0.1;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
else if (fishermen > 6 && fishermen <= 11)
{
price = rent - rent * 0.15;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
else if (fishermen >= 12)
{
price = rent - rent * 0.25;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
break;
case "Autumn":
rent = 4200;
if (fishermen <= 6)
{
price = rent - rent * 0.1;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else if (fishermen > 6 && fishermen <= 11)
{
price = rent - rent * 0.15;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else if (fishermen >= 12)
{
price = rent - rent * 0.25;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
break;
case "Winter":
rent = 2600;
if (fishermen <= 6)
{
price = rent - rent * 0.1;
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
else if (fishermen > 6 && fishermen <= 11)
{
price = rent - rent * 0.15;
if (budget >= price)
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
else if (fishermen >= 12)
{
price = rent - rent * 0.25;
if (budget >= price)
if (fishermen % 2 == 0)
{
price = price - price * 0.05;
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
else
{
if (budget >= price)
{
Console.WriteLine($"Yes! You have {budget - price:f2} leva left.");
}
else
{
Console.WriteLine($"Not enough money! You need {Math.Abs(budget - price):f2} leva.");
}
}
}
break;
}
}
}
}