Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ABSTRACTION, INHERITANCE AND COMPOSITION Create an abstract base class Person. Person object will have the following member fields. Name Id Address Since the address a

ABSTRACTION, INHERITANCE AND COMPOSITION

Create an abstract base class Person. Person object will have the following member fields.

Name

Id

Address

Since the address a more complex entity it will be defined by Address class. Here are the field necessary to define an address.

Street

City

Zip code

Country (country will have a default value USA)

The usage of the Address class in the Person class is form of composition.

Extending the abstract Person class we will create two concrete class (non-abstract).

Employee class

Student class

Employee class will have additional fields: salary and social security number. For security reason when we perform get on SSN it will only return the last 4 digits in the following format ##-##-1234.

Student class will have additional fields: gpa and number of credits completed

To test and the above created class we will create an application class (only class with public void main(String [] args) method). The application class should create 5 instances of Employee and 20 instances of Student class. Use data structure such as List<> or [] (array) to store the instances. For

example, List employees = new ArrayLists<>();

Print (System.out.println) the name and salary of all the Employees. Similarly print the name, address, and gpa of all created students.

HINT: may what to override the to string of Address to make it easy to print. Guidelines

All class should allow initialization of objects via constructor parameter.

All member fields should have the necessary accessor and mutator (i.e. getters and setters)

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_2

Step: 3

blur-text-image_3

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

Business Process Driven Database Design With Oracle PL SQL

Authors: Rajeev Kaula

1st Edition

1795532386, 978-1795532389

More Books

Students also viewed these Databases questions

Question

=+What benefits are there in direct mail?

Answered: 1 week ago

Question

Are these written ground rules?

Answered: 1 week ago

Question

Have ground rules been established for the team?

Answered: 1 week ago