Advertisement
GabrielHr00

04. Train The Trainers

Jun 18th, 2023
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.96 KB | None | 0 0
  1. package S6_NestedLoops;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class TrainTheTrainers {
  6.     public static void main(String[] args) {
  7.         Scanner scanner = new Scanner(System.in);
  8.         int juryCount = Integer.parseInt(scanner.nextLine());
  9.  
  10.         int allGradesCount = 0;
  11.         double sumAllGrades = 0.0;
  12.  
  13.         String command = scanner.nextLine();
  14.         while (!command.equals("Finish")) {
  15.             String presentationName = command;
  16.             double sum = 0.0;
  17.  
  18.             for (int i = 1; i <= juryCount; i++) {
  19.                 double grade = Double.parseDouble(scanner.nextLine());
  20.                 sum += grade;
  21.                 sumAllGrades += grade;
  22.                 allGradesCount++;
  23.             }
  24.  
  25.             System.out.printf("%s - %.2f.%n", presentationName, sum/juryCount);
  26.             command = scanner.nextLine();
  27.         }
  28.  
  29.         System.out.printf("Student's final assessment is %.2f.", sumAllGrades/allGradesCount);
  30.     }
  31. }
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement