Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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: superclass and subclasses. You can reuse the class of your assignment
as one of the three classes;
The subclasses inherit the superclass;
A main class main program to create instances, 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 java files: one per each class and one for the main class;
Write your classes under a package named assign;
Use the name convention: AssignpXXXXXXX as the class name of your main
No inner classes eg a class declared in the main class;
For the superclass:
Define properties of the class;
The properties must be common properties of the subclasses;
Override the toString method to output the values of all the properties;
For the subclasses:
Define additional properties of per each subclass;
The 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:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started