07. Hotel Room
Добър ден,
Опитвам се да реша горе-споменатата задача и не мога да разбера къде е грешката(70/100) а подобна грешка която не мога да проверя се случва за поредна задача.
Условие: https://prnt.sc/tn3s37
Мой код:
using System;
namespace _07.HotelRoom
{
internal class Program
{
static void Main(string[] args)
{
string month = Console.ReadLine();
int nights= int.Parse(Console.ReadLine());
double suitePrice = 0;
double flatPrice = 0;
double totalSuitePrice = 0;
double totalFlatPrice = 0;
if (month == "May" || month == "October")
{
suitePrice = nights * 50;
flatPrice = nights * 65;
if (nights<=7)
{ totalSuitePrice = suitePrice;
totalFlatPrice = flatPrice;
}
else if ( nights > 7 && nights<=14)
{ totalSuitePrice = suitePrice - (suitePrice * 0.05);
totalFlatPrice = flatPrice;
}
else if ( nights > 14)
{ totalSuitePrice = suitePrice - (suitePrice * 0.3);
totalFlatPrice = flatPrice - (flatPrice * 0.1);
}
}
else if (month == "June" || month == "September ")
{
suitePrice = nights * 75.20;
flatPrice = nights * 68.70;
if (nights<=14)
{ totalSuitePrice = suitePrice;
totalFlatPrice = flatPrice;
}
else if ( nights > 14)
{ totalSuitePrice = suitePrice - (suitePrice * 0.2);
totalFlatPrice = flatPrice - (flatPrice * 0.1);
}
}
else if (month == "July"|| month== "August")
{ suitePrice = nights * 76;
flatPrice = nights * 77;
if (nights > 14)
{
totalFlatPrice = flatPrice - (flatPrice * 0.1);
totalSuitePrice = suitePrice;
}
}
Console.WriteLine($"Apartment: {totalFlatPrice:F2} lv.");
Console.WriteLine($"Studio: {totalSuitePrice:F2} lv.");
}
}
}