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