задача New House
Здраяейте
На задача New House - получавам отговорите при зададените в документа вход на конзолата и въпреки това
имам 50/100. Това ми е решението.
using System;
namespace newHouse
{
class Program
{
static void Main(string[] args)
{
string typeFlower = Console.ReadLine();
int number = int.Parse(Console.ReadLine());
double budget = double.Parse(Console.ReadLine());
double sum = 0.0;
double restMoney = 0.0;
if (typeFlower == "Roses")
{
if (number > 80)
{
sum = (number * 5) - (0.1 * (number * 5));
}
else
{
sum = number * 5;
}
}
if (typeFlower == "Dahlias")
{
if (number > 90)
{
sum = (number * 3.80) - (0.15 * (number * 3.80));
}
else
{
sum = number * 3.80;
}
}
if (typeFlower == "Tulips")
{
if (number > 80)
{
sum = (number * 2.80) - (0.15 * (number * 2.80));
}
else
{
sum = number * 2.80;
}
}
if (typeFlower == "Narcissus")
{
if (number < 120)
{
sum = (number * 3) + (0.15 * (number * 3));
}
else
{
sum = number * 3.0;
}
}
if (typeFlower == "Gladiolus")
{
if (number < 80)
{
sum = (number * 2.50) + (0.2 * (number * 2.50));
}
else
{
sum = number * 2.50;
}
}
if (sum < budget)
{
restMoney = budget - sum;
Console.WriteLine($"Hey, you have a great garden with {number} {typeFlower} and {restMoney:f2} leva left.");
}
else if (sum > budget)
{
restMoney = sum - budget;
Console.WriteLine($"Not enough money, you need " + "{0:f2}" + " leva more.", restMoney);
}
}
}
}
Благодаря. Оправих го.