תרגיל מיונים של תלמידי כיתה

המסגרת

 

public static void printMenu(){

       System.out.println("Choose 1 to sort by name");

       System.out.println("Choose 2 to sort by math");

       System.out.println("Choose 3 to sort by english");

       System.out.println("Choose 4 to exit");

}

      

public static void main(String[] args) {

      

       Student [] arr = new Student[33];

             

       fillClass(arr);

       int choice = 0;

       printMenu();

       while (choice != 4){

              choice = reader.nextInt();

              if (choice == 1){

                     sortByName(arr);

                     printArr(arr);

              }

              else if (choice == 2){

                     sortByMath(arr);

                     printArr(arr);

              }

              else if (choice == 3){

                     sortByEng(arr);

                     printArr(arr);

              }

              printMenu();

       }

       System.out.println("Thank you");

      

}