Question: [ 1 ] 6 . Develop a Java program that includes the following ( see the UML Class Diagram below ) : ( a )
Develop a Java program that includes the following see the UML Class Diagram below:
a
one constants which is MAXSPEED int that is kilometers per hour
one abstract method public float goint 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
b an class Car which implements the Movable and Comparable interface that:
has instance data model String and topSpeed int compares two cars based on topSpeed
only has a twoargument constructor for setting the model and topSpeed. A car's topSpeed must be positive but if the topSpeed is greater that MAXSPEED, just set it to MAXSPEED overrides the Object's toString method so that it prints out the model and topSpeed of the car for example: VW
implements any additional required methods the ones that if not implemented will cause a compilation error
Was instance data for hasTurbo boolean Has threeargument 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, true" has turbo or "Audi, false" no turbo
you don't need to write any setters or getters methods for this class
d A public class CarCollection that has:
an array named carList that is initialized to have cars; two Car VW top speed: and Ford, top speed: and one SportsCar Audi top speed: turbo: truethe 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, trueFiat, false
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
