Advertisement
radidim

Bonus_Scoring_System (C# Shell App Paste)

May 13th, 2020
1,668
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. //Disclaimer: The creator of 'C# Shell (C# Offline Compiler)' is in no way responsible for the code posted by any user.
  2. using System;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Collections.Generic;
  6.  
  7. namespace Bonus_Scoring_System
  8. {
  9.  
  10.     public static class Program
  11.     {
  12.         public static void Main()
  13.         {
  14.            var students = int.Parse(Console.ReadLine());
  15.            var lectures = int.Parse(Console.ReadLine());
  16.            var bonus = int.Parse(Console.ReadLine());
  17.            
  18.            var attendances = new int[students];
  19.            var totalBonuses= new double[attendances.Length];
  20.            
  21.            
  22.            for(int i = 0;i<attendances.Length;i++)
  23.            {
  24.             attendances[i] = int.Parse(Console.ReadLine());
  25.             totalBonuses[i] = (double)attendances[i] / lectures * (5 + bonus);
  26.            
  27.            }
  28.            foreach(var item in totalBonuses)
  29.            {
  30.             Console.Write(Math.Round(item) + " ");
  31.            }
  32.            Console.WriteLine(" ");
  33.            var studentAttendances = 0;
  34.            var maxBonusPoints = 0.00;
  35.            for(int j=0;j<totalBonuses.Length-1;j++)
  36.            {
  37.             for(int k=j+1;k<totalBonuses.Length;k++)
  38.             {
  39.                
  40.                 if(totalBonuses[j]>=totalBonuses[k] && maxBonusPoints < totalBonuses[j])
  41.                 {
  42.                     maxBonusPoints = totalBonuses[j];
  43.                     studentAttendances = attendances[j];
  44.                    
  45.                 }
  46.                
  47.             }
  48.        
  49.          
  50.            }
  51.            
  52.             Console.WriteLine($"Max Bonus: {Math.Round(maxBonusPoints)}.");
  53.             Console.WriteLine($"The student has attended {studentAttendances} lectures.");
  54.        
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement