Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE THIS IN JAVA ASAP! New Concepts to be applied for the assignment Working with Java Hierarchies: interfaces, abstract classes, child classes Overriding methods

image text in transcribedPLEASE WRITE THIS IN JAVA ASAP!

New Concepts to be applied for the assignment Working with Java Hierarchies: interfaces, abstract classes, child classes Overriding methods and calling parent methods Representing hierarchical relationships and the protected level of access permission using UML class diagrams Description To get credit for this assignment you must use the starting interface and class definitions (Location of starting code] because this assignment will build on the code provided in those files. Unless explicitly mentioned in the assignment you cannot modify the existing code in the interface and these classes. You can actually must) add new code specified to the classes in order to get credit. Class Car: Implement the body of the method starto which sets the engineOn attribute to true. Write the header definition for the abstract method travelOne Unit() which takes no arguments and returns void. Because the method is abstract it should not have curly braces to enclose a body, Class Compact: Write the body for method travelOne Unito which is non-abstract in this class. The method will reduce the fuel of the car by the amount specified by the namned constant defined in this class FUEL CONSUMPTION. Because the fuel attribute is private to class Car, the travelOneUnit() method must make the change via the consume Fuel0 method of class Car. Class SUV Write the body for method travelOne Unit() which is non-abstract in this class. The method will reduce the fuel of the car by the amount specified by the value stored in the named constant defined in this class, SUV, FUEL CONSUMPTION. (Note: the value of the constant will be different value than the value stored in class Compact!) Again the consume Fuel method of class Car must be used to change the value of the fuel attribute Write the body the method toggleAll WheelDrive() which flips the state of the attribute allWheel DriveEngaged. Class Driver (the previous features need to be implemented first) In specified location in main() before the second set of output messages write the code to get the cars in each of the array elements to travel 1 unit using the travelOneUnit() method. In specified location in main() before the third set of output messages write the code to get the SUV to toggle the AWD mechanism using the toggleAllWheelDrive() method. 1 A header definition includes: method name, return type and parameter information. UML class diagram Draw out a UML diagrar for the following classes: Car, Compact, SUV, as well the Vehicle interface. Make sure you use the correct rotation for the attributes, methods, access permissions and relationships. Don't use the 'lollipop notation for the interface because you need to specify the method signatures

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

What is a key advantage of contiguous allocation for dile storage?

Answered: 1 week ago