desislava_topuzakova

04. Train The Trainers

Jul 16th, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.45 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class demo {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int countJury = Integer.parseInt(scanner.nextLine());
  7.         double sumGradesAllPresentations = 0;
  8.         int countGrades = 0;
  9.         while (true) {
  10.             String presentation = scanner.nextLine();
  11.             if (presentation.equals("Finish")) {
  12.                 break;
  13.             }
  14.             //име на презентация -> получаваме оценка от всеки един от журито
  15.             //сума от оценка
  16.             double sumGradesPerPresentation = 0;
  17.             for (int jury = 1; jury <= countJury ; jury++) {
  18.                 //дава оценка
  19.                 double grade = Double.parseDouble(scanner.nextLine());
  20.                 sumGradesPerPresentation += grade;
  21.                 sumGradesAllPresentations += grade;
  22.                 countGrades++; //общ брой получени оценки
  23.             }
  24.             //изчисляване на средно аритметичното
  25.             double averagePerPresentation = sumGradesPerPresentation / countJury;
  26.             System.out.printf("%s - %.2f.%n",presentation, averagePerPresentation);
  27.         }
  28.  
  29.         double averageForAll = sumGradesAllPresentations / countGrades;
  30.         System.out.printf("Student's final assessment is %.2f.", averageForAll);
  31.  
  32.     }
  33. }
Add Comment
Please, Sign In to add comment