Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You would like to create a collection of classes for things you can drive ( e . g . Boat, Plane, Car, Bike, Skateboard )

You would like to create a collection of classes for things you can "drive" (e.g. Boat, Plane, Car, Bike, Skateboard) in Java. Every class should include the methods steerLeft(int amount), steerRight (int amount), brake(int amount), and accellerate (int amount). Because the controls are so different between each class, no default methods will be provided for any of these. Each class will have to provide its own code. Which of the following would be more appropriate to use in this case?
An abstract class called Vehicle
An interface called Driveable
An exception handler
An ArrayList of Objects: ArrayList0bject> allVehicles;
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

More Books

Students also viewed these Databases questions

Question

5-6 How will MIS help my career?

Answered: 1 week ago