outprintlnThe average overall mark for held students average private static

Outprintlnthe average overall mark for held students

This preview shows page 27 - 29 out of 29 pages.

System.out.println("The average overall mark for held students: " + average); } private static double computeAverageMark() {//calculate average of all students int sum = 0; int n = 0; for (Student st : students) { if (st != null) { sum += st.getOverallMark(); n++; }
Image of page 27
ICT104 Assignment 2 - Solution } return sum / n; //average = sum/count } private static void displayAllStudents() { //displayAllStudents data System.out.println("id\t\t " + "Name\t\t " + "Date of Birth\t " + "First Assignment\t" + " Second Assignment\t" + " Practical Work\t " + "Final Exam\t " + "Overall Mark\t\t " + "Grade\t"); for (Student st : students) { if (st != null) { st.outputRecord(input); } } } private static void addStudent() { // add a new student record in array int i = 0; while (students[i] != null) { i++; } students[i] = new Student(); students[i].inputRecord(input); System.out.println("Student's record entered.");
Image of page 28
ICT104 Assignment 2 - Solution } }
Image of page 29

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture