Софтуерно Инженерство
Loading...
Miglena1234 avatar Miglena1234 1 Точки

06.Fishing Boat-Programming Basics with C#

Здравейте,

имам проблем със задача 6-Fishing Boat-линк:https://softuni.bg/trainings/resources/officedocument/35586/exercise-problem-descriptions-programming-basics-bulgaria-october-2018/2158

Това е решението ми:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace fishingBoat
{
    class Program
    {
        static void Main(string[] args)
        {
            int budget = int.Parse(Console.ReadLine());
            string season = Console.ReadLine();
            int fishers = int.Parse(Console.ReadLine());

            double priceShip = 0;
            double discount = 0;

            if (season == "Spring")
            {
                priceShip = 3000;
            }
            else if (season == "Summer" || season == "Autumn")
            {
                priceShip = 4200;
            }
            else if (season == "Winter")
            {
                priceShip = 2600;
            }
            if (fishers <= 6)
            {
               
                discount = 0.1;
            }
            else if (fishers >= 7 && fishers <= 11)
            {
                discount = 0.15;
            }
            else if (fishers >= 12)
            {
                discount = 0.25;
            }
            if (fishers % 2 == 0 && season != "Autumn")
            {
                discount = 0.05 + discount;
            }

            double total = priceShip - priceShip * discount;
            if (total > budget)
            {
                double moneyNeeded = total - budget;
                Console.WriteLine($"Not enough money! You need {moneyNeeded:f2} leva.");
            }
            else if (total < budget)
            {
                double moneyLeft = budget - total;
                Console.WriteLine($"Yes! You have {moneyLeft:F2} leva left.");
            }

        }
        }
    }


Във Visual Studio всички изходи са ми верни, но в Judge ми дава 46/100 и следната грешка:

"The process executing your submission for this test may not have received the output successfully. Please try to submit again the same solution. If the result does not change, then search the error in the submission itself." на тест 1 и 3.

Къде бъркам?

Благодаря предварително!

Тагове:
0
Programming Basics with C#
OOrlinBaltadzhiev avatar OOrlinBaltadzhiev 5 Точки

Здравей, това е моето решение малко по-различно.

100/100

0