Advertisement
Guest User

BonusScoringSystem90/100

a guest
Oct 21st, 2022
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.89 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class test {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.  
  9.         int studentsCount = Integer.parseInt(scanner.nextLine());
  10.         int lecturesCount = Integer.parseInt(scanner.nextLine());
  11.         int bonusInput = Integer.parseInt(scanner.nextLine());
  12.         int mostAttendances = Integer.MIN_VALUE;
  13.  
  14.  
  15.         for (int i = 1; i <= studentsCount; i++) {
  16.             int attendanceInput = Integer.parseInt(scanner.nextLine());
  17.  
  18.             if (attendanceInput > mostAttendances) {
  19.                 mostAttendances = attendanceInput;
  20.             }
  21.  
  22.         }
  23.         double bonus = (mostAttendances * 1.0) / lecturesCount * (5 + bonusInput);
  24.  
  25.         System.out.printf("Max Bonus: %.0f.\n", Math.ceil(bonus));
  26.         System.out.printf("The student has attended %d lectures.", mostAttendances);
  27.     }
  28. }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement