desislava_topuzakova

04. Train The Trainers

Nov 8th, 2020
2,092
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.29 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.         String command = scanner.nextLine();
  8.         //Finish Или име на презентация
  9.         double sumAllGrades = 0; //сумата от оценките за всички презентации
  10.         int countAllGrades = 0; //броят на всички оценки
  11.         while(!command.equals("Finish")) {
  12.             //име на презентация
  13.             String presentation = command;
  14.             double sumGradePerPresentation = 0;
  15.             for (int jury = 1; jury <= countJury ; jury++) {
  16.                 double grade = Double.parseDouble(scanner.nextLine());
  17.                 countAllGrades++;
  18.                 sumGradePerPresentation += grade;
  19.                 sumAllGrades += grade;
  20.             }
  21.             double averageGrade = sumGradePerPresentation / countJury;
  22.             System.out.printf("%s - %.2f.%n", presentation, averageGrade);
  23.             command = scanner.nextLine();
  24.         }
  25.  
  26.         double averageAll = sumAllGrades / countAllGrades;
  27.         System.out.printf("Student's final assessment is %.2f.", averageAll);
  28.     }
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment