hi guys I am new to java and my java teacher gave me an exercise to write a code about a parking and I am facing difficult time solving it can you help me please?
the exercise is:
a class vehicle is described by the instance variables; matriculation number, mark , owner's name and place number. only the variable 'owner's name' is private and the others are public.
a- implement the class 'Vehicle' and its constructor.
b- add an access method to the variable ' owner's name'
c-add a method toString() to return a string containing all the information of the vehicle.
now let's implement a class 'car' and a class ' van' derived from the class 'vehicle' . the class 'car' has an additional instance variable denoting the color of the car and a static variable denoting the number of cars. the class 'van' has an additional instance variable denoting the length of the van and a static variable denoting the number of vans.
d- implement the two classes 'car' and 'van' with their constructors.
e- add to each class the method to String().
now let's implement a class 'parking' to manage the entry and exit of vehicles from the parking.
at the entrance of each vehicle (car or van) a place number is assigned to this vehicle. the class 'parking' is described by a table of type 'vector' and a variable size that represents the maximum capacity of the parking.
f- ad to the class 'parking' a method enter (vehicle v , int place) permitting to enter a vehicle v in the parking and assign to it a place. this method adds the vehicle to the table 'vector' if there is still available space.
g- add to the class 'parking' a method 'exit' (vehicle v) to exit the vehicle v from the parking, this operation deletes the vehicle from the table ' vector'.
h - add to the class 'parking' a method search(vehicle v) allowing returning the place of the vehicle in the parking. if the vehicle does not exists the methods returns -1.
i- to test your program add to the class 'parking the method main that does the following actions:
-create an object parking
-initialize its size to 100
-create two car objects with references v1 an v2
-create two car objects with references van1 an van2
-enter the four vehicles to the parking
-exit van van1 from the parking
- check if the van2 is still in the parking. if the vans exists, display the information.
please guys this homework has 30 % of my final grade , your help is highly appreciated.