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

08.Scholarship

Здравейте, на тази задача изкарвам 93/100 точки в judge дали някой може да ме посъветва къде греша.

 

using System;

namespace SumSeconds
{
    class Program
    {
        static void Main(string[] args)
        {
            double income = double.Parse(Console.ReadLine());
            double avgScore = double.Parse(Console.ReadLine());
            double avgSalary = double.Parse(Console.ReadLine());
            double socialScholarships = avgSalary * 0.35;
            double gradeScholarship = 25 * avgScore;
            if (avgScore >= 5.50 && gradeScholarship >= socialScholarships)
            {
                Console.WriteLine($"You get a scholarship for excellent results {Math.Floor(gradeScholarship)} BGN");
            } else if (income < avgSalary && avgScore > 4.50){
                Console.WriteLine($"You get a Social scholarship {Math.Floor(socialScholarships)} BGN");
            }
            else
            {
                Console.WriteLine("You cannot get a scholarship!");
            }
        }
    }
}

Тагове:
1
Programming Basics with C#
kkaraivanov avatar kkaraivanov 490 Точки

Здравей. Пускам ти едно решение, мисля че ще откриеш грешките.

            double income = double.Parse(Console.ReadLine());
            double averageSuccess = double.Parse(Console.ReadLine());
            double minimalSalary = double.Parse(Console.ReadLine());

            double socialScholarship = Math.Floor(minimalSalary * 0.35);
            double execellentSuccessScholarship = Math.Floor(averageSuccess * 25);
            double printEscelentScholership = 0;

            if (socialScholarship > execellentSuccessScholarship)
            {
                printEscelentScholership = socialScholarship;
            }
            else
            {
                printEscelentScholership = execellentSuccessScholarship;
            }

            if (income <= minimalSalary && averageSuccess > 4.5 && averageSuccess < 5.5)
            {
                Console.WriteLine($"You get a Social scholarship {socialScholarship} BGN");
            }
            else if (income <= minimalSalary && averageSuccess >= 5.5)
            {
                Console.WriteLine($"You get a scholarship for excellent results {printEscelentScholership} BGN");
            }
            else if (income > minimalSalary && averageSuccess >= 5.5)
            {
                Console.WriteLine($"You get a scholarship for excellent results {execellentSuccessScholarship} BGN");
            }
            else
            {
                Console.WriteLine("You cannot get a scholarship!");
            }

 

0
krum_43 avatar krum_43 535 Точки

Ето ти още едно решение 100/100.

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

namespace Scholarship
{
    class Program
    {
        static void Main(string[] args)
        {
            double dohodProPerson = double.Parse(Console.ReadLine());
            double grade = double.Parse(Console.ReadLine());
            double mindohod= double.Parse(Console.ReadLine());
            double socialscholarship = 0.35 * mindohod;
            double schoolmoney = grade * 25;
            int socialschipround =(int)Math.Floor(socialscholarship);
            int scholmoneyround = (int)Math.Floor(schoolmoney);
            if (grade<=4.50)
            {
                Console.WriteLine("You cannot get a scholarship!");
                return;
            }
            if((grade>4.50)&&(grade<5.50))
            {
                if(dohodProPerson<mindohod)
                {
                    Console.WriteLine($"You get a Social scholarship {socialschipround} BGN");
                    return;
                }
                else
                {
                    Console.WriteLine("You cannot get a scholarship!");
                }
            }
            if(grade>=5.50)
            {
                if (dohodProPerson < mindohod)
                {
                    if (schoolmoney >= socialscholarship)
                    {
                        Console.WriteLine($"You get a scholarship for excellent results {scholmoneyround} BGN");
                    }  
                    else
                    {
                        Console.WriteLine($"You get a Social scholarship {socialschipround} BGN");
                        return;
                    }
                }
                else
                {
                    Console.WriteLine($"You get a scholarship for excellent results {scholmoneyround} BGN");
                }
                    
            }
        }
    }
}
 

0