Viktomirova

06._Exam_Results

Jun 14th, 2020
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _06._Exam_Results
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             string name = Console.ReadLine();
  10.             double points = 0;
  11.             while (name != "Midnight")
  12.             {
  13.                 double pointsCounter = 0;
  14.                 for (int i = 1; i <= 6; i++)
  15.                 {
  16.                     points = double.Parse(Console.ReadLine());
  17.                     if (points < 0)
  18.                     {
  19.                         Console.WriteLine($"{name} was cheating!");
  20.                         break;
  21.                     }
  22.                     pointsCounter += points;
  23.                 }
  24.                 double totalPoints = Math.Floor(pointsCounter / 600 * 100);
  25.                 double rate = totalPoints * 0.06;
  26.                 if (rate >= 5.00 && points >= 0)
  27.                 {
  28.                     Console.WriteLine("===================");
  29.                     Console.WriteLine("|   CERTIFICATE   |");
  30.                     Console.WriteLine($"|    {rate:f2}/6.00    |");
  31.                     Console.WriteLine("===================");
  32.                     Console.WriteLine($"Issued to {name}");
  33.                 }
  34.                 else if (rate < 5 && rate >= 3 && points >= 0)
  35.                 {
  36.                     Console.WriteLine($"{name} - {rate:f2}");
  37.                 }
  38.                 else if (rate < 3.00 && rate >= 0 && points >= 0)
  39.                 {
  40.                     Console.WriteLine($"{name} - 2.00");
  41.                 }
  42.                 name = Console.ReadLine();
  43.             }
  44.         }
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment