05. Fishing Boat - Nested Conditional Statements - Exercise
Здравейте! Някой може ли да ми посочи къде бъркам?
Дава ми 60 точки в системата, но не ми показва кой тест гърми.
using System;
namespace ConsoleApp24
{
class Program
{
static void Main(string[] args)
{
int budget = int.Parse(Console.ReadLine());
string season = Console.ReadLine();
int fishmans = int.Parse(Console.ReadLine());
double currentPrice = 0.0;double total = 0.0;
if (season == "Spring" && fishmans <=6)
{
total = 3000 - (3000* 0.1);
}
if (season == "Spring" && fishmans >= 7 && fishmans <=11)
{
total = 3000 - (3000 * 0.15);
}
if (season == "Spring" && fishmans >= 12)
{
total = 3000 - (3000 * 0.25);
}
if (season == "Summer" && fishmans <= 6)
{
total = 4200 - (4200 * 0.1);
}
if (season == "Summer" && fishmans >= 7 && fishmans <= 11)
{
total = 4200 - (4200 * 0.15);
}
if (season == "Summer" && fishmans >= 12)
{
total = 4200 - (4200 * 0.25);
}
if (season == "Autumn" && fishmans <= 6)
{
total = 4200 - (4200 * 0.1);
}
if (season == "Autumn" && fishmans >= 7 && fishmans <= 11)
{
total = 4200 - (4200 * 0.15);
}
if (season == "Autumn" && fishmans >= 12)
{
total = 4200 - (4200 * 0.25);
}
if (season == "Winter" && fishmans <= 6)
{
total = 2600 - (2600 * 0.1);
}
if (season == "Winter" && fishmans >= 7 && fishmans <= 11)
{
total = 2600 - (2600 * 0.15);
}
if (season == "Winter" && fishmans >= 12)
{
total = 2600 - (2600 * 0.25);
}
if (fishmans%2 == 0 && season != "Autumn")
{
total = total - ( total * 00.5);
}
if (total <= budget)
{
Console.WriteLine($"Yes! You have {(budget - total):f2} leva left.");
}
if (total > budget)
{
Console.WriteLine($"Not enough money! You need {(total - budget):f2} leva.");
}
}
}
}
Здравей Иван,
Видях, че всички са я решили с метода, който ми препоръчваш - явно наистина е по-ясен.
Ще му отделя време и внимание :)
Много благодаря!