-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBonusScoringSystem.java
More file actions
31 lines (23 loc) · 975 Bytes
/
Copy pathBonusScoringSystem.java
File metadata and controls
31 lines (23 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package MidExam;
import java.util.Scanner;
public class BonusScoringSystem {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int numberStudents = Integer.parseInt(scanner.nextLine());
int lectures = Integer.parseInt(scanner.nextLine());
int bonus = Integer.parseInt(scanner.nextLine());
double maxBonus = Double.MIN_VALUE;
int maxAttendance = 0;
for (int i = 0; i < numberStudents ; i++) {
int attendance = Integer.parseInt(scanner.nextLine());
double totalBonus = (attendance * 1.00 / lectures) * (5 + (bonus));
if(totalBonus > maxBonus){
maxBonus = totalBonus;
maxAttendance = attendance;
}
}
maxBonus = Math.round(maxBonus);
System.out.printf("Max Bonus: %.0f.%n",maxBonus);
System.out.printf("The student has attended %d lectures.",maxAttendance);
}
}