问题描述:
java求助 英文好的来,
Define a class called PoliceDatabase with the following instance variables:
//这个Arraylist 不会写 CLASS 类vehicles,drivers,infractions 都写好了.
vehicles – an ArrayList storing all vehicles in the database
drivers – an ArrayList storing all drivers (i.e., people who drive vehicles) in the database
infractions – an ArrayList storing all infractions that have ever been given to drivers
Write the following interesting methods:
//下面这些看不太懂,麻烦高手教下怎么写.
a zero-parameter constructor that initializes all the ArrayLists properly
registerDriver(Driver aDriver) which takes a Driver object as a parameter and then registers (i.e., remembers for later) the driver in the database.
registerVehicle(Vehicle aVehicle, String license) which takes a vehicle object as a parameter and the license ID of a driver who owns the vehicle and then registers the vehicle in the database by updating the vehicles list accordingly as well as storing the vehicle’s owner properly.
unregisterVehicle(String plate) which takes a vehicle’s plate as a parameter and then removes the vehicle from the database by updating the vehicles list accordingly.
reportStolen(String plate) records that the vehicle with the given plate number has been stolen.
changeOwner(String plate, String license) which updates the database by changing the owner information for the vehicle with the given plate to the driver with the given license ID.
Define a class called PoliceDatabase with the following instance variables:
//这个Arraylist 不会写 CLASS 类vehicles,drivers,infractions 都写好了.
vehicles – an ArrayList storing all vehicles in the database
drivers – an ArrayList storing all drivers (i.e., people who drive vehicles) in the database
infractions – an ArrayList storing all infractions that have ever been given to drivers
Write the following interesting methods:
//下面这些看不太懂,麻烦高手教下怎么写.
a zero-parameter constructor that initializes all the ArrayLists properly
registerDriver(Driver aDriver) which takes a Driver object as a parameter and then registers (i.e., remembers for later) the driver in the database.
registerVehicle(Vehicle aVehicle, String license) which takes a vehicle object as a parameter and the license ID of a driver who owns the vehicle and then registers the vehicle in the database by updating the vehicles list accordingly as well as storing the vehicle’s owner properly.
unregisterVehicle(String plate) which takes a vehicle’s plate as a parameter and then removes the vehicle from the database by updating the vehicles list accordingly.
reportStolen(String plate) records that the vehicle with the given plate number has been stolen.
changeOwner(String plate, String license) which updates the database by changing the owner information for the vehicle with the given plate to the driver with the given license ID.
问题解答:
我来补答展开全文阅读