Vacation
Здравейте!
Може ли малко помощ за тази задача!
3. Vacation - Basic Syntax, Conditional Statements and Loops - Exercise
Дава ми 87/100, а при тестовете всичко работи.
https://pastebin.com/Fu9Cu1NP
Благодаря предварително!
using System;
namespace Vacation
{
class Program
{
static void Main(string[] args)
{
int number = int.Parse(Console.ReadLine());
string typeOfGroup = Console.ReadLine();
string dayOfWeek = Console.ReadLine();
double pricePerson = 0;
double totalPrice = 0;
if (typeOfGroup == "Students")
{
if (dayOfWeek == "Friday")
pricePerson = 8.45;
if (dayOfWeek == "Saturday")
pricePerson = 9.80;
if (dayOfWeek == "Sunday")
pricePerson = 10.46;
}
else if (typeOfGroup == "Business")
{
if (dayOfWeek == "Friday")
pricePerson = 10.90;
if (dayOfWeek == "Saturday")
pricePerson = 15.60;
if (dayOfWeek == "Sunday")
pricePerson = 16;
}
else if (typeOfGroup == "Regular")
{
if (dayOfWeek == "Friday")
pricePerson = 15;
if (dayOfWeek == "Saturday")
pricePerson = 20;
if (dayOfWeek == "Sunday")
pricePerson = 22.50;
}
if (typeOfGroup == "Business" && number >= 100)
{
number -= 10;
}
totalPrice = pricePerson * number;
if (typeOfGroup == "Students" && number >= 30)
totalPrice *= 0.85;
if (typeOfGroup == "Regular" && (number >= 10 && number <= 20))
totalPrice *= 0.95;
Console.WriteLine($"Total price: {totalPrice:f2}");
}
}
}