Question: Lab 8: Abstract Classes and Interfaces Overview: In this lab you will practice extending abstract classes and implementing interfaces Both abstract classes and interfaces are



Lab 8: Abstract Classes and Interfaces Overview: In this lab you will practice extending abstract classes and implementing interfaces Both abstract classes and interfaces are ways of defining types within a type hierarchy, and neither can be directly instantiated. A. Provided Code You are provided with a zip file containing an abstract class Vehicle and an interface Reversible Thing. Vehicle is an abstract class that gives a partial specification of how vehicles behave. It contains two methods, one of which is abstract. The abstract method is refuel(). This is a way of saying that all vehicles need to be refueled, but that the refueling methods may vary among the subclasses of Vehicle (e.g. gas, diesel, electric, solar, vegetable oi...). So the abstract superclass gives no implementation. The implemented method is moveForward), which just contains a generic print statement about moving forward ReversibleThing is an interface containing one abstract method, reverse). Anything that implements ReversibleThing has to implement reverse. B. New Classes You need to create 3 new classes based on the following UML diagram. Vehicle
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
