private static void displayAllStudents2 displayAllStudents data

Private static void displayallstudents2

This preview shows page 32 - 36 out of 48 pages.

private static void displayAllStudents2() { //displayAllStudents data System.out.println("id\t\t " + "Name\t\t " + "Date of Birth\t " + "Group Assimment\t" + " Weekly Tutorial\t " + "postgraduate Exam\t " + "Overall Mark\t\t " + "Grade\t " + "<POSTGRADUATE>\t"); for (PostgraduateStudent st : students2) { if (st != null) { st.outputRecord2(input); } } } private static void addStudent() { // add a new student record in array int i = 0; choice = 1; System.out.println("Undergraduate(1) or Postgraduate(2)"); choice = input.nextInt(); //take input from user into choice if (choice == 1){ while (students[i] != null) { i++; } students[i] = new UndergraduateStudent(); students[i].inputRecord(input); System.out.println("Student's record entered."); } else if (choice == 2){ while (students2[i] != null) { i++; } students2[i] = new PostgraduateStudent(); students2[i].inputRecord2(input); System.out.println("Student's record entered."); } else{ System.out.println("Error"); } } } _________________________ Student.java ______________________________ public class Student { Electronic Assignment Submission and Marking Working Party - Final Report to Academic Council 28 October 2019 Page 32
Image of page 32
// Students all information that is entered public String title; public String firstName; public String lastName; public long id; public int day; public int month; public int year; public int firstA; public int secondA; public int thirdA; public int practicalW; public int finalExam; public int overallMark; public String grade; public int marks; // end //<editor-fold defaultstate="collapsed" desc="Constructors..."> public Student() { } public Student(String title, String firstName, String lastName, long id, int day, int month, int year, int firstA, int secondA, int thirdA, int practicalW, int finalExam) { this.title = title; this.firstName = firstName; this.lastName = lastName; this.id = id; this.day = day; this.month = month; this.year = year; } //</editor-fold> //<editor-fold defaultstate="collapsed" desc="Setter ... Getter ... Methods"> public String getTitle() { return title; Electronic Assignment Submission and Marking Working Party - Final Report to Academic Council 28 October 2019 Page 33
Image of page 33
} public void setTitle(String title) { this.title = title; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public long getId() { return id; } public void setId(long id) { this.id = id; } public int getDay() { return day; } public void setDay(int day) { this.day = day; } public int getMonth() { return month; } public void setMonth(int month) { this.month = month; Electronic Assignment Submission and Marking Working Party - Final Report to Academic Council 28 October 2019 Page 34
Image of page 34
} public int getYear() { return year; } public void setYear(int year) { this.year = year; } //</editor-fold> } _________________________ UndergraduateStudent.java ______________________________ import java.util.Scanner; public class UndergraduateStudent extends Student { public UndergraduateStudent() { } public UndergraduateStudent(String title, String firstName, String lastName, long id, int day, int month, int year, int firstA, int secondA, int thirdA, int practicalW, int finalExam) { this.title = title; this.firstName = firstName; this.lastName = lastName; this.id = id; this.day = day; this.month = month; this.year = year; this.firstA = firstA; this.secondA = secondA; this.thirdA = thirdA; this.practicalW = practicalW;
Image of page 35
Image of page 36

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture