Create a Vehicle class the has the private variables registationNumber (int) and owner (String).
Then, create a subclass Of the vehicle class called Car. The car the following public variables:brand, and maxSpeed (String, int, int). When you create a car, you should be able to set all three parameters and the two parameters of the superclass Vehicle.
Finally, create a Roster class which should have as a variable an Arraylist of Cars, When you create a object, the arraylist should be empty. In the class, create a method that adds cars to the roster and a method that finds how many cars have n doors, with n as an input.
Then, in your program, create 3-5 cars and a new Roster. Add the cars in the Roster. Then, search the Roster to find how many cars have 5 doors. Finally, find the person who owns a Suzuki. (one of the cars you create should be a Suzuki for this)
Reviews
There are no reviews yet.