Advertisement
AngelKejov

Bonus Scoring System

Jun 15th, 2021
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.company;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class P01BonusScoringSystem {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner sc = new Scanner(System.in);
  9.  
  10.         double countOfStudents = Double.parseDouble(sc.nextLine());
  11.         double countOfLectures = Double.parseDouble(sc.nextLine());
  12.         double initialBonus = Double.parseDouble(sc.nextLine());
  13.  
  14.         int maxBonus = Integer.MIN_VALUE;
  15.         int maxAtt = Integer.MIN_VALUE;
  16.         for (int i = 0; i < countOfStudents; i++) {
  17.             int attendances = Integer.parseInt(sc.nextLine());
  18.  
  19.             double temp = Math.round(attendances / countOfLectures
  20.                     * (5 + initialBonus));
  21.  
  22.             if (temp > maxBonus) {
  23.                 maxBonus = (int)temp;
  24.                 maxAtt = attendances;
  25.             }
  26.         }
  27.  
  28.         System.out.println("Max Bonus: " + maxBonus + ".");
  29.         System.out.printf("The student has attended %d lectures.", maxAtt);
  30.     }
  31. }
  32.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement