Advertisement
CR7CR7

bonus

Oct 22nd, 2022
981
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.86 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. import java.util.*;
  4.  
  5. public class BonusScoringSystem {
  6.  
  7.     public static void main(String[] args) {
  8.  
  9.         Scanner scan = new Scanner(System.in);
  10.         int students = Integer.parseInt(scan.nextLine());
  11.         int lectures = Integer.parseInt(scan.nextLine());
  12.         int additionalBonus = Integer.parseInt(scan.nextLine());
  13.  
  14.         double max = 0;
  15.         double maxBonus = 0;
  16.  
  17.         for (int i = 0; i < students; i++) {
  18.             double attendances = Double.parseDouble(scan.nextLine());
  19.             if (attendances > max) {
  20.                 max = attendances;
  21.                 maxBonus = ((attendances / lectures) * (5 + additionalBonus));
  22.             }
  23.         }
  24.         System.out.printf("Max Bonus: %.0f.%n", Math.ceil(maxBonus));
  25.         System.out.printf("The student has attended %.0f lectures.", max);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement