Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package _06_NestedLoops;
- import java.util.Scanner;
- public class TrainTheTrainers {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int gradersCount = Integer.parseInt(scanner.nextLine());
- double totalSum = 0.0;
- int totalCount = 0;
- String command = scanner.nextLine();
- while (!command.equals("Finish")) {
- String presentationName = command;
- double currentGradesSum = 0.0;
- for (int i = 1; i <= gradersCount; i++) {
- double grade = Double.parseDouble(scanner.nextLine());
- currentGradesSum += grade;
- totalSum += grade;
- totalCount++;
- }
- System.out.printf("%s - %.2f.%n", presentationName, currentGradesSum / gradersCount);
- command = scanner.nextLine();
- }
- System.out.printf("Student's final assessment is %.2f.", totalSum / totalCount);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement