Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
4.3 kB
0
Indexable
Never
using System;

public class Applicant
{
    public string FullName { get; set; }
    public double AverageGrade { get; set; }
    public double AchievementPoints { get; set; }

    public Applicant(string fullName, double averageGrade, double achievementPoints)
    {
        FullName = fullName;
        AverageGrade = averageGrade;
        AchievementPoints = achievementPoints;
    }

    public Applicant()
    {

    }

    public static bool operator >(Applicant applicant1, Applicant applicant2)
    {
        if (applicant1.AverageGrade > applicant2.AverageGrade)
        {
            return true;
        }
        else if (applicant1.AverageGrade == applicant2.AverageGrade)
        {
            return applicant1.AchievementPoints > applicant2.AchievementPoints;
        }
        return false;
    }

    public static bool operator <(Applicant applicant1, Applicant applicant2)
    {
        if (applicant1.AverageGrade < applicant2.AverageGrade)
        {
            return true;
        }
        else if (applicant1.AverageGrade == applicant2.AverageGrade)
        {
            return applicant1.AchievementPoints < applicant2.AchievementPoints;
        }
        return false;
    }
}

public static class Admission
{
    public static double PassingGrade { get; set; } = 4.5;

    public static bool CheckPassingGrade(Applicant applicant)
    {
        return applicant.AverageGrade >= PassingGrade;
    }
}


public class Program
{
    public static void Main(string[] args)
    {
        

        Applicant applicant1 = new Applicant();
        Console.WriteLine("Введите полное имя первого претендента:");
        applicant1.FullName = Console.ReadLine();

        Console.WriteLine("Введите средний балл первого претендента:");
        double applicant1AverageGrade = Convert.ToDouble(Console.ReadLine());
        applicant1.AverageGrade = applicant1AverageGrade;

        Console.WriteLine("Введите количество достижений первого претендента:");
        double applicant1AchievementPoints = Convert.ToDouble(Console.ReadLine());
        applicant1.AchievementPoints = applicant1AchievementPoints;

        Applicant applicant2 = new Applicant();
        Console.WriteLine("Введите полное имя второго претендента:");
        applicant2.FullName = Console.ReadLine();

        Console.WriteLine("Введите средний балл второго претендента:");
        double applicant2AverageGrade = Convert.ToDouble(Console.ReadLine());
        applicant2.AverageGrade = applicant2AverageGrade;

        Console.WriteLine("Введите количество достижений второго претендента:");
        double applicant2AchievementPoints = Convert.ToDouble(Console.ReadLine());
        applicant2.AchievementPoints = applicant2AchievementPoints;


        if (Admission.CheckPassingGrade(applicant1))
        {
            Console.WriteLine($" {applicant1.FullName} хватает проходного балла.");
        }
        else
        {
            Console.WriteLine($" {applicant1.FullName} не хватает проходного балла.");
        }

        if (Admission.CheckPassingGrade(applicant2))
        {
            Console.WriteLine($" {applicant2.FullName} хватает проходного балла.");
        }
        else
        {
            Console.WriteLine($" {applicant2.FullName} не хватает проходного балла.");
        }

        if (applicant1 > applicant2)
        {
            Console.WriteLine($" {applicant1.FullName} средний балл больше чем у {applicant2.FullName}.");
        }
        else if (applicant1 < applicant2)
        {
            Console.WriteLine($" {applicant2.FullName} средний балл больше чем у {applicant1.FullName}.");
        }
        else
        {
            Console.WriteLine($" {applicant1.FullName} и {applicant2.FullName} имеют одинаковую оценку.");
        }
    }
}