Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package examPreparation;
- import java.util.Scanner;
- public class P01BonusScoringSystem {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int countStudents = Integer.parseInt(scanner.nextLine());
- int countLectures = Integer.parseInt(scanner.nextLine());
- int initBonus = Integer.parseInt(scanner.nextLine());
- double maxBonus = Integer.MIN_VALUE;
- int maxAttendances = 0;
- for (int i = 0; i < countStudents; i++) {
- int attendances = Integer.parseInt(scanner.nextLine());
- double currentBonus = attendances * 1.0 / countLectures * (5 + initBonus);
- if (currentBonus > maxBonus) {
- maxBonus = currentBonus;
- maxAttendances = attendances;
- }
- }
- System.out.printf("Max Bonus: %.0f.%n", Math.ceil(maxBonus));
- System.out.printf("The student has attended %d lectures.", maxAttendances);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement