aneliabogeva

TrainTheTrainers

Dec 13th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TrainTheTrainers {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         Integer numberOfPeople = Integer.parseInt(scanner.nextLine());
  7.         String presentation = scanner.nextLine();
  8.         Double currentScore = 0.00;
  9.         Double finalScore = 0.00;
  10.         Integer counterPresentations = 0;
  11.         Double totalScore = 0.00;
  12.  
  13.         while (!"Finish".equals(presentation)){
  14.             for(int i=1; i<=numberOfPeople; i++){
  15.                 Double score = Double.parseDouble(scanner.nextLine());
  16.                 currentScore += score;
  17.             }
  18.             finalScore = currentScore / numberOfPeople;
  19.             System.out.printf("%s - %.2f.\n", presentation, finalScore);
  20.             counterPresentations += 1;
  21.             totalScore += finalScore;
  22.             presentation = scanner.nextLine();
  23.             currentScore = 0.00;
  24.         }
  25.         Double finalAssestment = totalScore / counterPresentations;
  26.         System.out.printf("Student's final assessment is %.2f.", finalAssestment);
  27.     }
  28. }
  29.  
Add Comment
Please, Sign In to add comment