#javaPB Graduation Part 2
Здравейте, колеги! Ако някой, може да каже какво пропускам в тази задача, ще съм много благодарна. judje ми дава 44т.
import java.util.Scanner; public class Graduation2 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String name = scanner.nextLine(); double sum = 0; double gradeCounter = 0; double failGradeCounter = 0; while (gradeCounter < 12) { double grade = Double.parseDouble(scanner.nextLine()); if (grade >= 4) { sum += grade; gradeCounter++; } else { failGradeCounter++; } if (failGradeCounter > 1) { System.out.printf("%s has been excluded at %.0f grade", name, gradeCounter + 1); } } double average = sum / gradeCounter; System.out.printf("%s graduated. Average grade: %.2f", name, average); } }
Много благодаря!
Moля!