outprintlnFor the detail of student Systemoutprintln SystemoutprintEnter

Outprintlnfor the detail of student systemoutprintln

  • Murdoch University
  • ICT 167
  • nsah1994
  • 10
  • 100% (6) 6 out of 6 people found this document helpful

This preview shows page 5 - 9 out of 10 pages.

System.out.println();System.out.print("Enter student ID: ");long useID = keyboard.nextLong();boolean exist = false;for (int i = 0; i<student.total; i++){if(studentdata[i].studentIDGet()==useID){studentdata[i].Option3_Part1_OutputStudentDetails();exist = true;}}if(exist == false){System.out.println("Invalid entry, enter again!");
Background image
} System.out.println();System.out.println("*********************************************************************************");break;case 8: System.out.println("*********************************************************************************");System.out.println("Display details of students using names");System.out.println();System.out.println("For the detail of student: ");System.out.println();System.out.print("Enter first name: ");String useFirstName = keyboard.next();System.out.print("Enter last name: ");String useLastName = keyboard.next();boolean found = false;for (int i = 0; i<student.total; i++){if(studentdata[i].firstNameGet().equalsIgnoreCase(useFirstName) && studentdata[i].lastNameGet().equalsIgnoreCase(useLastName) ){studentdata[i].Option3_Part1_OutputStudentDetails();found = true;}}if(found == false){System.out.println("Invalid entry, enter again!");}System.out.println();System.out.println("*********************************************************************************");break;case 9: System.out.println("*********************************************************************************");System.out.println("Display two students with the highest overall marks ");System.out.println();double firstMark = 0, secondMark = 0, currentMark = 0;for (int i=0; i<student.total; i++){currentMark = studentdata[i].overallMark;if(currentMark>firstMark)
Background image
{secondMark = firstMark;firstMark = currentMark;}else if(currentMark>secondMark){secondMark = currentMark;}}System.out.println("Two students with the highest overall marks");System.out.println();System.out.println("First Top Student");for (int i=0; i<student.total; i++){System.out.println("Name : "+student.toString());System.out.println("The highest mark is: "+firstMark);}System.out.println("Second Top Student");for (int i=0; i<student.total; i++){System.out.println("Name : "+student.toString());System.out.println("The highest mark is: "+secondMark);}System.out.println();System.out.println("*********************************************************************************");break;case 10: System.out.println("*********************************************************************************");System.out.println("Sort student details in ascending order using student ID");System.out.println();System.out.println("Student details in ascending order using Student ID");System.out.println();int i;for (i = 0; i < count; i++){int minIndex = i;Student minValue = studentdata[i];for (int tmp = i+1; tmp < count; tmp++){if (studentdata[tmp].studentIDGet() < minValue.studentIDGet()){minValue = studentdata[tmp];minIndex = tmp;}}Student tempValue = studentdata[i];studentdata[i] = studentdata[minIndex];
Background image
studentdata[minIndex] = tempValue;}for(i=0; i<student.total; i++) {System.out.println();studentdata[i].Option3_Part1_OutputStudentDetails(); }System.out.println();System.out.println("*********************************************************************************");break;case 11: System.out.println("*********************************************************************************");System.out.println("Sort student details in ascending order using student's last name");System.out.println();System.out.println("Student details in ascending order using Student's Last Name");System.out.println();for (i = 0; i < count; i++){int minIndex = i;
Background image
Image of page 9

You've reached the end of your free preview.

Want to read all 10 pages?

  • One '14
  • Adrian Irvananto

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture