+ Нов въпрос
Aguzelov 78 Точки

## [Homework] Software Technologies - Java Basics - Exercises - 28 - Average Grades

Здравейте!

Ако може някой да ми разясни защо изкарвам 70/100.

Задача: Average Grades от Java Basics - Exercises

Условие: Define a class Student, which holds the following information about students: name, list of grades and average grade (calculated property, read-only). A single grade will be in range [2…6], e.g. 3.25 or 5.50.
Read a list of students and print the students that have average grade ≥ 5.00 ordered by name (ascending), then by average grade (descending). Print the student name and the calculated average grade.

https://judge.softuni.bg/Contests/Compete/Index/712#22

Решение : https://pastebin.com/UJyW9SEg

Тагове:
0
AtanasovAtanas 415 Точки

Пипнах ти малко кода. Ако имаш въпроси питай.  - Линк

0
02/12/2017 18:02:22
Aguzelov 78 Точки

Благодаря!

А как по-добре да напиша тези части?

``````//get average from ArrayList
Double total =0.0;
}

``````
String[] input = scanner.nextLine().split(" ");
String name = input[0];
//get subArrayList from array
`double[] studentGrades = Arrays.stream(tokens).skip(1).mapToDouble(Double::parseDouble).toArray();`
`double averageGrade = Arrays.stream(studentGrades).average().getAsDouble();`