Задача Gaming Store от C# Fundamentals
Дава ми 80/100 не мога да си намеря грешката , ще съм благодарен на по опитните да помогнат.
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
double balance = double.Parse(Console.ReadLine());
double totalSpend = 0;
while (true)
{
string game = Console.ReadLine();
if (game == "OutFall 4")
{
if (balance > 0)
{
if (balance >= 39.99)
{
balance -= 39.99;
totalSpend += 39.99;
Console.WriteLine($"Bought {game}");
}
}
}
else if (game == "CS: OG")
{
if (balance > 0)
{
if (balance >= 15.99)
{
balance -= 15.99;
totalSpend += 15.99;
Console.WriteLine($"Bought {game}");
}
else
{
Console.WriteLine("Too Expensive");
}
}
}
else if (game == "Zplinter Zell")
{
if (balance > 0)
{
if (balance >= 19.99)
{
balance -= 19.99;
totalSpend += 19.99;
Console.WriteLine($"Bought {game}");
}
else
{
Console.WriteLine("Too Expensive");
}
}
}
else if (game == "Honored 2")
{
if (balance > 0)
{
if (balance >= 59.99)
{
balance -= 59.99;
totalSpend += 59.99;
Console.WriteLine($"Bought {game}");
}
else
{
Console.WriteLine("Too Expensive");
}
}
}
else if (game == "RoverWatch")
{
if (balance > 0)
{
if (balance >= 29.99)
{
balance -= 29.99;
totalSpend += 29.99;
Console.WriteLine($"Bought {game}");
}
else
{
Console.WriteLine("Too Expensive");
}
}
}
else if (game == "RoverWatch Origins Edition")
{
if (balance > 0)
{
if (balance >= 39.99)
{
balance -= 39.99;
totalSpend += 39.99;
Console.WriteLine($"Bought {game}");
}
else
{
Console.WriteLine("Too Expensive");
}
}
}
else if (game == "Game Time")
{
Console.WriteLine($"Total spent: ${totalSpend:f2}. Remaining: ${balance:f2}");
break;
}
else
{
Console.WriteLine("Not Found");
}
if (balance == 0)
{
Console.WriteLine("Out of money!");
break;
}
}
}
}
}