Advertisement
DeeAG

01.BonusScoringSystem

Feb 23rd, 2021
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.02 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _01.BonusScoringSystem
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int countOfStudents = int.Parse(Console.ReadLine());
  10.             int countOfLectures = int.Parse(Console.ReadLine());
  11.             int additionalBonus = int.Parse(Console.ReadLine());
  12.  
  13.             double maxBonus = 0;
  14.             int attendedLectures = 0;
  15.  
  16.             for (int i = 0; i < countOfStudents; i++)
  17.             {
  18.                 int studentAttendances = int.Parse(Console.ReadLine());
  19.  
  20.                 double totalBonus = (double)studentAttendances / countOfLectures * (5 + additionalBonus);
  21.  
  22.                 if (totalBonus > maxBonus)
  23.                 {
  24.                     maxBonus = totalBonus;
  25.                     attendedLectures = studentAttendances;
  26.                 }
  27.             }
  28.  
  29.             Console.WriteLine($"Max Bonus: {Math.Ceiling(maxBonus)}.");
  30.             Console.WriteLine($"The student has attended {attendedLectures} lectures.");
  31.         }
  32.     }
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement