Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class demo {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int countJury = Integer.parseInt(scanner.nextLine());
- double sumGradesAllPresentations = 0;
- int countGrades = 0;
- while (true) {
- String presentation = scanner.nextLine();
- if (presentation.equals("Finish")) {
- break;
- }
- //име на презентация -> получаваме оценка от всеки един от журито
- //сума от оценка
- double sumGradesPerPresentation = 0;
- for (int jury = 1; jury <= countJury ; jury++) {
- //дава оценка
- double grade = Double.parseDouble(scanner.nextLine());
- sumGradesPerPresentation += grade;
- sumGradesAllPresentations += grade;
- countGrades++; //общ брой получени оценки
- }
- //изчисляване на средно аритметичното
- double averagePerPresentation = sumGradesPerPresentation / countJury;
- System.out.printf("%s - %.2f.%n",presentation, averagePerPresentation);
- }
- double averageForAll = sumGradesAllPresentations / countGrades;
- System.out.printf("Student's final assessment is %.2f.", averageForAll);
- }
- }
Add Comment
Please, Sign In to add comment