Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.util.Scanner;
- public class P01BonusScoringSystem {
- public static void main(String[] args) {
- Scanner sc = new Scanner(System.in);
- double countOfStudents = Double.parseDouble(sc.nextLine());
- double countOfLectures = Double.parseDouble(sc.nextLine());
- double initialBonus = Double.parseDouble(sc.nextLine());
- int maxBonus = Integer.MIN_VALUE;
- int maxAtt = Integer.MIN_VALUE;
- for (int i = 0; i < countOfStudents; i++) {
- int attendances = Integer.parseInt(sc.nextLine());
- double temp = Math.round(attendances / countOfLectures
- * (5 + initialBonus));
- if (temp > maxBonus) {
- maxBonus = (int)temp;
- maxAtt = attendances;
- }
- }
- System.out.println("Max Bonus: " + maxBonus + ".");
- System.out.printf("The student has attended %d lectures.", maxAtt);
- }
- }
Advertisement
Advertisement
Advertisement
RAW Paste Data
Copied
Advertisement