The task is as follows: Create a structure with the name student, containing the fields: last name and initials, group number, academic performance (an array of five elements). Create an array of ten elements of this type, arrange the records in ascending order of the average score. Add the ability to display the names and numbers of groups of students with grades equal to only 4 or 5.
It seems that everything is extremely simple, but I can not figure out how to make objects created with all the fields?
How to fix this code?
public class Students { private String name; private int numG; public int[] marks = new int[5]; private double sr; public Students(String name, int numG,int[] marks){ this.name = name; this.numG = numG; this.marks = marks } Class with Main:
Students [] stud; stud = new Students[] { new Students("Бочкарев И.С", 4, new int[]{4, 3, 5, 4, 5}); new Students("Петров И.С", 3, new int[]{4, 3, 5, 4, 5}); new Students("Иванов И.С", 4, new int[]{4, 4, 5, 4, 5}); new Students("Сидоров И.С", 2, new int[]{4, 3, 4, 4, 5}); new Students("Кузнецов И.С", 1, new int[]{4, 3, 5, 4, 5}); new Students("Долгов И.С", 4, new int[]{5, 5, 5, 5, 5}); new Students("Попов И.С", 3, new int[]{4, 4, 4, 4, 3}); new Students("Лопатин И.С", 3, new int[]{4, 5, 3, 4, 5}); new Students("Рубанок И.С", 2, new int[]{4, 3, 4, 4, 5}); new Students("Рубильник И.С", 1, new int[]{2, 3, 3, 4, 5}); }