Question: Simple Java Inheritance practice problem Description Write a class Person.java that acts as a person with Strings to hold their name and address. This class
Simple Java Inheritance practice problem



Description Write a class Person.java that acts as a person with Strings to hold their name and address. This class should also contain: A constructor, Person (String name, String address) Getters and Setters for name and address, respectively. . o String getName () o void setName (String name) o String getAddress () o void setAddress (String address) In addition, you will also create two subclasses of Person called Student.java and Professor.java. The Student class should contain: Unique Instance Variables: o String[] courses o char[] grades A constructor, Student(String name, string address) o You should initialize courses and grades here. - A new student's course array should have all entries as "none'" A new student's grades array should have all entries as A . A student can take at most 6 courses, therefore both courses and grades should be of length 6 Getters for courses and grades A unique method, boolean addCourse (string course) o This method will enroll the student in the given course so long as: . They are not currently enrolled in the course. . They are not already taking 6 courses, i.e. one or more entries in their courses array is none O New courses should be added to thelowest-numbered available slotin the courses array
Step by Step Solution
There are 3 Steps involved in it
To solve this problem well implement the classes Person Student Professor and Course according to the specifications given Heres a stepbystep implemen... View full answer
Get step-by-step solutions from verified subject matter experts
