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