Question: Assignment: Write Java program where it contains the following: Three classes: 1 superclass and 2 subclasses. You can reuse the class of your assignment 1

Assignment:
Write Java program where it contains the following:
Three classes: 1 superclass and 2 subclasses. You can reuse the class of your assignment
1 as one of the three classes;
The 2 subclasses inherit the superclass;
A main class (main program) to create 2 instances, 1 instance per each class. And then
output the values of all the properties (attributes) to the console. An example main
program is given for your reference.
Basic Requirement:
You need to submit 4. java files: one per each class and one for the main class;
Write your classes under a package named assign2;
Use the name convention: Assign2_pXXXXXXX as the class name of your main
No inner classes (e.g. a class declared in the main class);
For the superclass:
Define 2 properties of the class;
The 2 properties must be common properties of the 2 subclasses;
Override the toString() method to output the values of all the properties;
For the subclasses:
Define 2 additional properties of per each subclass;
The 2 additional properties must be specific properties of a subclass;
Override the toString() method to output the values of all the properties.
Example Code & Output:
An example main class and its output are given as follow:
 Assignment: Write Java program where it contains the following: Three classes:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!