outprintlnThe average overall mark for held students average private static

# Outprintlnthe average overall mark for held students

• Homework Help
• 29
• 95% (21) 20 out of 21 people found this document helpful

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++; }
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.");
ICT104 Assignment 2 - Solution } }