we going to use intellij program – writinghub.net

we going to use intellij program – writinghub.net


Two instance variables that are arrays, one of Car array type and one of Motorcycle array type.

A “run” method that does the following:

Instantiates three objects of Car type and three of Motorcycle type.

Sets the “running” variable on each to false.

Fills the other instance variables on each object directly in code with any value you wish.

So if you had “color” as a variable of String type in MotorVehicle, set one to “red”, one to “green”, etc.

Put all the objects into the two arrays mentioned above.

(car objects in cars array, motorcycle objects in motorcycles array)

Then displays a series of things to the user with the following flow:

First a menu for choosing which car to START:

Lists the cars with numbers and asks which one to start.

Use 1 to 3 as menu item numbers instead of 0 to 2.

When item # chosen, then the start method for that object is called.

The number they enter has to be adjusted for the correct array index obviously.

Second is the menu for which motorcycle to START:

Same as above except now for the motorcycle array.

Third is the menu for which car to STOP:

Same as the ones above except now the stop method is being called instead of start.

Fourth is the menu for which motorcycle to STOP.

Same as above, but now for motorcycle.

Fifth, display all 6 vehicles status on whether they’re running or not.


Put the main method here.

In the method, simply instantiate an instance of VehicleManager and call its “run” method.

Writing Hub