Професионална програма
Loading...
+ Нов въпрос
alexiev_bg avatar alexiev_bg 3 Точки

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}");


        }
    }
}

Тагове:
0
Module: C# Advanced
kkaraivanov avatar kkaraivanov 490 Точки
Best Answer

Здравей. Сложи по едно "m" зад цените и процентите.

0
inkarnasion avatar inkarnasion 278 Точки

Сменяваш променливите от double да са decimal, и слагаш М след сметките, ето ти поправения код.

https://pastebin.com/vEvCYuHN

0
alexiev_bg avatar alexiev_bg 3 Точки

Всичко е  ОК. Благодаря!

0
soxicu avatar soxicu 0 Точки

From these letters there are many things which are being verified for the concern people working with them. I am sure that you are able to understand the things I have been trying to explain. In modern days the business of catering has been going on the top and there are many firms that are providing law essay help uk for that. It sure is a good idea to get professionals for this job.

0