DanikYakush

Task43

Jul 12th, 2022 (edited)
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.63 KB | None | 0 0
  1. public class Task43{
  2.  
  3.     public static void main(String[] args) {
  4.  
  5.         Student[] studentList = new Student[10];
  6.  
  7.         studentList[0] = new Student("Alex", "Ferguson", "MU", new int[] { 5, 6, 7, 8, 9 });
  8.         studentList[1] = new Student("Zinedin", "Zidan", "Real", new int[] { 6, 8, 9, 9, 8 });
  9.         studentList[2] = new Student("Ole", "Soulsher", "MU", new int[] { 8, 9, 8, 9, 8 });
  10.         studentList[3] = new Student("Klaudio", "Ranieri", "Lester", new int[] { 6, 8, 9, 9, 8 });
  11.         studentList[4] = new Student("Jrgen", "Klopp", "Liverpool", new int[] { 9, 10, 9, 10, 9 });
  12.         studentList[5] = new Student("Josep ", "Guardiola", "Man City", new int[] { 6, 8, 9, 9, 8 });
  13.         studentList[6] = new Student("Ralf ", "Rangnick", "Man Utd", new int[] { 6, 8, 9, 9, 8 });
  14.         studentList[7] = new Student("Michael ", "Carrick", "Man Utd", new int[] { 6, 8, 9, 9, 8 });
  15.         studentList[8] = new Student("Eddie", "Howe", "Newcastle", new int[] { 9, 9, 9, 9, 9 });
  16.         studentList[9] = new Student("Steve", "Bruce", "Newcastle", new int[] { 10, 10, 10, 9, 9,10 });
  17.  
  18.         studentCheck(studentList);
  19.  
  20.        
  21.     }
  22.  
  23.     public static void studentCheck(Student[] studentList) {
  24.         int idealmark1 = 9;
  25.         int idealmark2 = 10;
  26.  
  27.         for (int i = 0; i < studentList.length; i++) {
  28.             int countOfIdealMarks = 0;
  29.  
  30.             for (int j = 0; j < studentList[i].getmarkList().length; j++) {
  31.                 if (studentList[i].getmarkList()[j] == idealmark1 ||
  32.                     studentList[i].getmarkList()[j] == idealmark2) {
  33.                     countOfIdealMarks++;
  34.                 }
  35.             }
  36.             if(countOfIdealMarks == studentList[i].getmarkList().length ) {
  37.                 System.out.println(studentList[i].toString());
  38.             }
  39.             countOfIdealMarks=0;
  40.         }
  41.     }
  42.  
  43. }
Add Comment
Please, Sign In to add comment