Advertisement
Guest User

Untitled

a guest
Jan 21st, 2020
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Scholarships
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double income = double.Parse(Console.ReadLine());
  10.             double grade = double.Parse(Console.ReadLine());
  11.             double minSalary = double.Parse(Console.ReadLine());
  12.            
  13.             double minScoreSocial = 4.5;
  14.             double minScoreGrade = 5.5;
  15.             double gradeOdd = 25.0;
  16.             double socialScholarshipFormula;
  17.             double gradeScholarshipFormula;
  18.  
  19.             bool socialScholarship = (income < minSalary && grade >= minScoreSocial);
  20.             bool gradeScholarship = (grade >= minScoreGrade);
  21.                        
  22.             bool cantGetBoth = (!socialScholarship && !gradeScholarship);
  23.            
  24.             if (socialScholarship)
  25.             {
  26.                 socialScholarshipFormula = Math.Floor(minSalary * 0.35);
  27.             }
  28.             else
  29.             {
  30.                 socialScholarshipFormula = 0;
  31.             }
  32.            
  33.             if (gradeScholarship)
  34.             {
  35.                 gradeScholarshipFormula = Math.Floor(grade * gradeOdd);
  36.             }
  37.             else
  38.             {
  39.                 gradeScholarshipFormula = 0;
  40.             }
  41.            
  42.             if (cantGetBoth)
  43.             {
  44.                 Console.WriteLine("You cannot get a scholarship!");
  45.             }
  46.             else if (socialScholarshipFormula > gradeScholarshipFormula)
  47.             {
  48.                 Console.WriteLine($"You get a Social scholarship {socialScholarshipFormula} BGN");
  49.             }
  50.             else
  51.             {
  52.                 Console.WriteLine($"You get a scholarship for excellent results {gradeScholarshipFormula} BGN");
  53.             }
  54.         }
  55.     }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement