SHARE
TWEET

Untitled

a guest Feb 29th, 2020 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. namespace BonusScoringSystem
  4. {
  5.     public class BonusScoringSystem
  6.     {
  7.         public static void Main()
  8.         {
  9.             int studentsCount = int.Parse(Console.ReadLine());
  10.             int lecturesCount = int.Parse(Console.ReadLine());
  11.             int initialBonus = int.Parse(Console.ReadLine());
  12.  
  13.             decimal bestTotalBonus = 0;
  14.             int maxAttendanceCount = 0;
  15.  
  16.             decimal currentStudentTotalBonus = 0;
  17.             for (int i = 0; i < studentsCount; i++)
  18.             {
  19.                 int currentStudentAttendances = int.Parse(Console.ReadLine());
  20.  
  21.                 currentStudentTotalBonus = (decimal)currentStudentAttendances / (decimal)lecturesCount * (5 + initialBonus);
  22.  
  23.                 if (currentStudentTotalBonus > bestTotalBonus)
  24.                 {
  25.                     bestTotalBonus = currentStudentTotalBonus;
  26.                 }
  27.  
  28.                 if (currentStudentAttendances > maxAttendanceCount)
  29.                 {
  30.                     maxAttendanceCount = currentStudentAttendances;
  31.                 }
  32.             }
  33.  
  34.             Console.WriteLine($"Max Bonus: {Math.Ceiling(bestTotalBonus)}.");
  35.             Console.WriteLine($"The student has attended {maxAttendanceCount} lectures.");
  36.         }
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top