Задача 3. Хотелска стая Basics 28 август 2016
Здравейте, имам проблем с тази задача. Достигам само 80т. и не мога да разбера къде ми е грешката. Ето го моя код :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HotelRooms
{
class Program
{
static void Main(string[] args)
{
string month = Console.ReadLine().ToLower();
int nights = int.Parse(Console.ReadLine());
double studio = 0;
double apartment = 0;
if (month == "may" || month == "october")
{
apartment = nights >= 14 ? (nights * 65 * 0.90) : nights * 65;
if (nights > 7 && nights <= 14)
{
studio = nights * 50 * 0.95;
}
else if (nights > 14)
{
studio = nights * 50 * 0.70;
}
else { studio = nights * 50; }
}
else if (month == "june" || month == "september")
{
apartment = nights > 14 ? nights * 68.70 * 0.90 : nights * 68.70;
if (nights> 14)
{
studio = 75.20 * 0.20 * nights;
}
else { studio = 75.20 * nights; }
}
else if ( month == "july"|| month== "august")
{
apartment = nights > 14 ? (nights * 77 * 0.90) : nights * 77;
studio = 76 * nights;
}
Console.WriteLine($"Apartment: { apartment:f2} lv.");
Console.WriteLine($"Studio: {studio:f2} lv.");
}
}
}
Благодаря много! :)