clipro

Untitled

Oct 18th, 2018
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.56 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _18_scholarship
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             // user input
  14.             var income = double.Parse(Console.ReadLine());
  15.             var score = double.Parse(Console.ReadLine());
  16.             var mrz = double.Parse(Console.ReadLine());
  17.  
  18.             // define variables
  19.             double socialScholarship = 0.0;
  20.             double excelScholarship = 0.0;
  21.             double scholarship = 0.0;
  22.  
  23.             // socieal scholarship
  24.             socialScholarship = Math.Floor( (income < mrz && score > 4.50) ?  mrz * 0.35 : 0.0 );
  25.  
  26.             // excellent score
  27.             excelScholarship = Math.Floor( (score >= 5.50) ? score * 25 : 0.0 );
  28.  
  29.             // bigger schilarship
  30.             scholarship = Math.Max(socialScholarship, excelScholarship);
  31.  
  32.             if (scholarship == 0.0)
  33.             {
  34.                 Console.WriteLine("You cannot get a scholarship!");
  35.             }
  36.             else
  37.             {
  38.                 if (socialScholarship > excelScholarship)
  39.                 {
  40.                     Console.WriteLine("You get a Social scholarship {0} BGN",
  41.                         socialScholarship);
  42.                 }
  43.                 else
  44.                 {
  45.                     Console.WriteLine("You get a scholarship for " +
  46.                         "excellent results {0} BGN", excelScholarship);
  47.                 }
  48.             }
  49.  
  50.         }
  51.     }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment