Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment 9: Inheritance (Chapter 10) Using the solution to your assignment 5, do the following: Create a sub class that inherits everything from your base
Assignment 9: Inheritance (Chapter 10) Using the solution to your assignment 5, do the following: Create a sub class that inherits everything from your base class. (For example, if Car is the base class then SportsCar could be your sub class) [1 point] Provide at least one additional attribute to your subclass [1 point] o Create gettter/setter methods for it. Create a default constructor for the subclass, that uses super to call the base class default constructor. [1 point o It should set all attributes in the subclass as well as the super class to default values .Create a parameterized constructor for the subclass, that uses keyword super to pass the inherited parameters to the base class. [1 point] o It should set all attributes in the subclass as well as the super class to the values that are passed in to the constructor. Override the display0 method to print out all the instance variable values from the base class, and also from the sub class. [1 point] In your main method, create 2 new object using your subclass, set the data, and call the display method. Create one object using the no-arg (default) constructor of your sub-class. [1 point] Call the set methods to set all attribute data associated to that object. Call the display method for that object Create one object using the parameterized constructor of your sub-class. [1 point] - Call the display0 method for this object too
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