Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create the following classes: Boat ( 1 5 ) Should have the following attributes: weight, length, name Should have the method move that returns Spin
Create the following classes:
Boat
Should have the following attributes: weight, length, name
Should have the method move that returns "Spin propeller"
Car
Should have the following attributes: passengers, doors
Should have the method that returns "Spin wheels"
Amphibian should be a child of Boat and Car
Should inherit the attributes and methods from the parent classes
Should have the additional attributes modes and
modes should consist only of 'land' and 'water'. The user should not be able to add to change or modify these options
mode should store the current mode being used
Should have the method move that returns "Spin wheels" or "Spin propeller" depending on what mode the Amphibian is in This
should be done by calling the appropiate parent class method
Should have a togglemode method that checks mode against modes and changes mode accordingly
Should have a factory method that creates an Amphibian. The user should be able to name the Amphibian
Requirements:
All attributes should be properly encapsulated
Each different method of encapsulation should be used at least once
Bonus:
Make the setter so that when the user cannot change the values for:
modes
mode
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