Question #246574

StudentLoans class This class has a menu control method that allow users to add a Student or PostGraduate object to an array. The array allows for 20 elements, but the array may contain less elements. The number of elements if the arrays is available in the variable noOfStudents. 1 Code a no-argument constructor. In this constructor, a) Add 2 Student objects to the Students array. b) Add 2 PostGraduate objects to the Students array. c) Set noOfStudents to 4. 2 Code a method menu() that returns an int value. This value represents the choice the user has made from the available menu options. a) Define a Scanner variable to read from the keyboard. b) Define an int value, named choice. c) Display a menu in the following forma

Expert's answer

import com.demo.Student;
import com.demo.PostGraduate;

public class StudentLoans {
  private List<Student> students;
  private int noOfStudents;
  public StudentLoans() {
    students = new ArrayList<Students>();
    students.add(new Student());
    students.add(new Student());
    students.add(new PostGraduate());
    students.add(new PostGraduate());
    noOfStudents = 4;
  }
  public void menu() {
    // here imple...
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

LATEST TUTORIALS
APPROVED BY CLIENTS