Advertisement
Guest User

Untitled

a guest
Apr 18th, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. 4. Average Grades
  2. 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.
  3. 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.
  4. Examples
  5. Input Output
  6. 3
  7. Ivan 3
  8. Todor 5 5 6
  9. Diana 6 5.50 Diana -> 5.75
  10. Todor -> 5.33
  11. 6
  12. Petar 3 5 4 3 2 5 6 2 6
  13. Mitko 6 6 5 6 5 6
  14. Gosho 6 6 6 6 6 6
  15. Ani 6 5 6 5 6 5 6 5
  16. Iva 4 5 4 3 4 5 2 2 4
  17. Ani 5.50 5.25 6.00 Ani -> 5.58
  18. Ani -> 5.50
  19. Gosho -> 6.00
  20. Mitko -> 5.67
  21. Hints
  22. • Create class Student with properties Name (string), Grades (double[]), and property AverageGrade (calculated by LINQ as Grades.Average(), read-only).
  23. • Make a list of students and filter with LINQ all students that has average grade >= 5.00.
  24. • Print the filtered students ordered by name in ascending order, then by average grade in descending order.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement