Advertisement
Lyubohd

04. Train The Trainers

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