Advertisement
Kur23

kurec

Oct 23rd, 2021
865
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.99 KB | None | 0 0
  1. import java.io.PrintStream;
  2. import java.util.Scanner;
  3.  
  4. public class asdfghg {
  5.     public static void main(String[] args) {
  6.         Scanner scanner = new Scanner(System.in);
  7.         int jury = Integer.parseInt(scanner.nextLine());
  8.         String presentation = scanner.nextLine();
  9.         double sumForAll = 0;
  10.         int counter = 0;
  11.         while (!presentation.equals("Finish")) {
  12.             double sumGrades = 0;
  13.             for (int i = 0; i < jury; i++) {
  14.                 double grade = Double.parseDouble(scanner.nextLine());
  15.                 counter++;
  16.                 sumGrades += grade;
  17.                 sumForAll += grade;
  18.             }
  19.             double average = sumGrades / jury;
  20.             System.out.printf("%s - ", presentation);
  21.             System.out.printf("%.2f.\n", average);
  22.             presentation = scanner.nextLine();
  23.         }
  24.         double averageAll = sumForAll / counter;
  25.         System.out.printf("Student's final assessment is %.2f.\n", averageAll);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement