Answered step by step
Verified Expert Solution
Link Copied!

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 (15)
Should have the following attributes: weight, length, name
Should have the method move that returns "Spin propeller"
Car(15)
Should have the following attributes: passengers, doors
Should have the method that returns "Spin wheels"
Amphibian should be a child of Boat and Car (70)
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 (10)
mode should store the current mode being used (10)
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 (20)
Should have a toggle_mode method that checks mode against modes and changes mode accordingly (20)
Should have a factory method that creates an Amphibian. The user should be able to name the Amphibian (10)
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 (10)
mode (10)
image text in transcribed

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David M. Kroenke, David J. Auer

7th edition

133544621, 133544626, 0-13-354462-1, 978-0133544626

More Books

Students also viewed these Databases questions

Question

=+forms of primary research for business communication purposes

Answered: 1 week ago

Question

RETScreen Expert

Answered: 1 week ago