Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

With java, define a class named Person that contains two instance variables of type String that stores the first name and last name of a

With java, define a class named Person that contains two instance variables of type String that stores the first name and last name of a person and appropriate accessor and mutator methods. Also create a method named displayDetails that outputs the details of a person.

Define a class named Student that is derived from Person. Student should have instance variables of student ID, course, and teacher name. The class Student should have appropriate constructor(s), which should call the constructor of Person, which should receive first name and last name from the class Student. The constructor of Student should also take values to the corresponding instance variables. This class should redefine the displayDetails method to print person details as well as details of a student.

Define a class named Teacher that is derived from Person. This class should include appropriate constructor(s), and and contain instance variables for the subject name and salary. Finally, redefine the displayDetails method to include all teacher information in the printout.

Create a main method that creates at least two student objects and two teacher objects with different values and calls displayDetails for each.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

14-18 Compare the two major types of planning and control tools.

Answered: 1 week ago