THIS IS JAVA ONLY. PLEASE POST SCREENSHOTS OF THE CODE.Make it as simple as possible, and comment on more complicatedlines. Thanks!
1. Create a Class named Person(Person.java), including name, gender, age, and address. This class should include a constructor and toString() method. To string, method should print the name, gender, age, and address. 2. Inherit the Person class to design the Teacher class(Teacher.java), and add title, department, and salary fields. 3. Inherit the Person class to design Student class(Student.java), add student ID, major, and year (freshman, sophomore, junior, and senior). 4. For both student and teacher classes' write constructors and toString() methods, this toString() method should print all details, meaning the information from the superclass and from a subclass. Note, call the superclass toString method from the subclass toString() method to retrieve data from the superclass and also concatenate/add the subclass specified data. 5. Create a driver class (Main.java) or tester class and create two objects (student1, teacher1), one for the student and one for the teacher: - Print the information of both objects using the toString() method.
THIS IS JAVA ONLY. PLEASE POST SCREENSHOTS OF THE CODE. Make it as simple as possible, and comment on more complicated l
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am