Проблем със задача.
Задача:
https://softuni.bg/downloads/svn/programming-basics/2018-06/Exam/05.%20Game%20Info.pdf
Моето решение:
https://pastebin.com/63XfCnG3
Задача:
https://softuni.bg/downloads/svn/programming-basics/2018-06/Exam/05.%20Game%20Info.pdf
Моето решение:
https://pastebin.com/63XfCnG3
Здравейте,вашият код 100 от 100. Бяхте разменили проверките за допълнителното време и дузпите,както и накрая имахте изход с 4 реда, а се искат 3.
import java.util.Scanner;
public class GameInfo {
public static void main(String[] args) {
Scanner scanner =new Scanner(System.in);
String nameTeam =scanner.nextLine();
int games =Integer.parseInt(scanner.nextLine());
int sumMinutes =0;
double MiddleMinutes =0;
int Penalty =0;
int ExtraTime =0;
for (int i = 1; i <=games ; i++) {
int minutes =Integer.parseInt(scanner.nextLine());
sumMinutes+=minutes;
if (minutes>90 && minutes<=120) {
ExtraTime+=1;
}
if (minutes>120){
Penalty+=1;
}
}
MiddleMinutes=sumMinutes*1.00/games;
System.out.printf("%s has played %d minutes. Average minutes per game: %.2f%n",nameTeam,sumMinutes,MiddleMinutes);
System.out.printf("Games with penalties: %d%n",Penalty);
System.out.printf("Games with additional time: %d",ExtraTime);
}
}
Благодаря.