Question: [ 1 ] 6 . Develop a Java program that includes the following ( see the UML Class Diagram below ) : ( a )

[1]
6. Develop a Java program that includes the following (see the UML Class Diagram below):
(a)NAninterfaceMovablethathas:
one constants which is MAX_SPEED (int) that is 150kph(kilometers per hour)
one abstract method public float go(int distance). When this method is implemented in a class, it returns the time is takes a car to travel the distance using the car's topSpeed. The calculation for time is calculated at:
time =distancetopSpeed
(b) an class Car which implements the Movable and Comparable interface that:
512
212
has instance data model (String) and topSpeed (int). compares two cars based on topSpeed
only has a two-argument constructor for setting the model and topSpeed. A car's topSpeed must be positive but if the topSpeed is greater that MAX_SPEED, just set it to MAX_SPEED overrides the Object's toString method so that it prints out the model and topSpeed of the car (for example: "VW,100")
implements any additional required methods (the ones that if not implemented will cause a compilation error).
Was instance data for hasTurbo (boolean)- Has three-argument constructor that will set the model, the topSpeed and hasTurbo - overrides the toString () method so that it prints the model of car, top speed, and if it has a turbo or not (for example: "Audi, 150, true" (has turbo) or "Audi, 150, false" (no turbo))
you don't need to write any setters or getters methods for this class
[2](d) A public class CarCollection that has:
an array named carList that is initialized to have 3 cars; two Car (VW, top speed: 120kph and Ford, top speed: 100kph) and one SportsCar (Audi, top speed: 150kph. turbo: true)(the order does not matter). Assume any order of the cars and any values for their attributes.
a method void printSportsCar() that will only print out info for SportsCar in the array carList. Your method needs to work with any size of array carList
(e) Design printSportsCar() such that it will only print out the SportsCar in ascending order based on speed. The order of items in the carList array must remain the same after calling printSportsCar().
Carcollection
Sample run:Output:Audi, 110, trueFiat, 140, false
[ 1 ] 6 . Develop a Java program that includes

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!