Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- import java.util.List;
- import java.util.Scanner;
- import java.util.stream.Collectors;
- public class BonusScoringSystem {
- 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 = 0;
- int maxAttendance = 0;
- for (int i = 0; i < countStudents; i++) {
- int attendance = Integer.parseInt(scanner.nextLine());
- double currentBonus = attendance * 1.0 / countLectures * (5 + initBonus);
- if (currentBonus > maxBonus) {
- maxBonus = currentBonus;
- maxAttendance = attendance;
- }
- }
- System.out.printf("Max Bonus: %.0f.%n", Math.ceil(maxBonus));
- System.out.printf("The student has attended %d lectures.", maxAttendance);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment