Advertisement
Dianov

Conditional Statements - Exercise (08. Scholarship (not included in final score))

Oct 18th, 2020 (edited)
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.22 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 Scholarship
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double moneyIncome = double.Parse(Console.ReadLine());
  14.             double score = double.Parse(Console.ReadLine());
  15.             double minSalary = double.Parse(Console.ReadLine());
  16.  
  17.             double socialStipendy = minSalary * 0.35;
  18.             socialStipendy = Math.Floor(socialStipendy);
  19.             double excellentScoreStipendy = score * 25;
  20.             excellentScoreStipendy = Math.Floor(excellentScoreStipendy);
  21.  
  22.             if (moneyIncome >= minSalary) // няма право за социална стипендия
  23.             {
  24.                 if (score >= 5.50) // има право за стипендия за отличен успех
  25.                 {
  26.                     Console.WriteLine("You get a scholarship for excellent results {0} BGN", excellentScoreStipendy);
  27.                 }
  28.                 if (score < 5.50) // няма право за стипендия за отличен успех
  29.                 {
  30.                     Console.WriteLine("You cannot get a scholarship!");
  31.                 }
  32.             }
  33.             if (moneyIncome < minSalary) // има право за социална стипендия
  34.             {
  35.                 if (score >= 5.50) // има право за стипендия за отличен успех
  36.                 {
  37.                     if (socialStipendy < excellentScoreStipendy) // ако парите за отличен успех са повече - получава стипендия за отличен успех
  38.                     {
  39.                         Console.WriteLine("You get a scholarship for excellent results {0} BGN", excellentScoreStipendy);
  40.                     }
  41.                     else if (socialStipendy == excellentScoreStipendy) // ако парите от двете стипендии са равни -> получава за отличен успех
  42.                     {
  43.                         Console.WriteLine("You get a scholarship for excellent results {0} BGN", excellentScoreStipendy);
  44.                     }
  45.                     else // ако парите за отличен успех са по-малко - получава социална стипендия
  46.                     {
  47.                         Console.WriteLine("You get a Social scholarship {0} BGN", socialStipendy);
  48.                     }
  49.                 }
  50.                 if (score > 4.50 && score < 5.50) // няма успех за стипендия за отличен, но има за социална -> получава социална стипендия
  51.                 {
  52.                     Console.WriteLine("You get a Social scholarship {0} BGN", socialStipendy);
  53.                 }
  54.                 if (score <= 4.50) // няма успех за социална стипендия и правото му да получи отпада => не получава стипендия
  55.                 {
  56.                     Console.WriteLine("You cannot get a scholarship!");
  57.                 }
  58.             }
  59.         }
  60.     }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement