CSharp-Fundamentals-Intro-and-Basic-Syntax-Exercise 3. Vacation
Имам нужда от помощ, някой ако може да ми покаже къде ми е грешката в кода. Пробвах да реша задачата по 3 различни начина и всеки път ми дава 83/100. Благодаря предварително.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _3_Vacation_2._0
{
class Program
{
static void Main(string[] args)
{
int groupCount = int.Parse(Console.ReadLine());
string groupType = Console.ReadLine();
string dayOfWeek = Console.ReadLine();
double singularPrice = 0;
double totalPrice = 0;
if (groupType == "Students")
{
if (dayOfWeek == "Friday")
{
singularPrice = 8.45;
}
else if (dayOfWeek == "Saturday")
{
singularPrice = 9.80;
}
else if (dayOfWeek == "Sunday")
{
singularPrice = 10.46;
}
if (groupCount >= 30)
{
totalPrice = (singularPrice * groupCount)*85/100;
}
else
{
totalPrice = singularPrice * groupCount;
}
}
else if (groupType == "Business")
{
if (dayOfWeek == "Friday")
{
singularPrice = 10.90;
}
else if (dayOfWeek == "Saturday")
{
singularPrice = 15.60;
}
else if (dayOfWeek == "Sunday")
{
singularPrice = 16;
}
if (groupCount >= 100)
{
totalPrice = singularPrice * (groupCount - 10);
}
else
{
totalPrice = singularPrice * groupCount;
}
}
else if (groupType == "Regular")
{
if (dayOfWeek == "Friday")
{
singularPrice = 15;
}
else if (dayOfWeek == "Saturday")
{
singularPrice = 20;
}
else if (dayOfWeek == "Sunday")
{
singularPrice = 22.5;
}
if (groupCount >= 10 && groupCount <= 20)
{
totalPrice = (singularPrice * groupCount) * 95 / 100;
}
else
{
totalPrice = singularPrice * groupCount;
}
}
Console.WriteLine($"Total price: {totalPrice:f2}");
}
}
}