class VehicleManager
extends java.lang.Object
Constructor and Description |
---|
VehicleManager()
The constructor for the VehicleManager class creates an ArrayList of Vehicle
objects called
vehicleDB . |
Modifier and Type | Method and Description |
---|---|
(package private) boolean |
addVehicle(java.util.Scanner kb)
Attempts to add a new vehicle to the database in memory.
|
boolean |
deleteVehicle(java.lang.String vin)
Deletes a vehicle from the runtime database, (assuming the vehicle
existed in the database).
|
java.util.ArrayList<Vehicle> |
getVehicleDB()
This method allows retrieving the current runtime vehicle database.
|
(package private) boolean |
readDB()
Attempts to read in from the database file called
vehicles.db
and load each vehicle's info into the runtime database. |
(package private) boolean |
readSaleDB()
Attempts to read in from the database file called
sales.db
and load each sale transaction's info into the runtime database. |
boolean |
saveSalesDB()
Attempts to write the existing sales runtime database to the database file.
|
boolean |
saveVehicleDB()
Attempts to write the existing runtime vehicle database to the database file.
|
(package private) int |
search(java.lang.String s)
Given a VIN number, attempts to locate the vehicle in question in the
runtime database.
|
(package private) boolean |
sellVehicle(java.util.Scanner kb,
PersonManager userManager)
This method allows making a sale of an existing vehicle in the runtime database.
|
java.util.ArrayList<Vehicle> |
showPriceRange(double lower,
double higher,
java.lang.String type)
Allows filtering of the runtime database by a price range.
|
(package private) boolean |
verifyExistanceOfVin(java.lang.String vin)
This method allows for verification of the existence of a vehicle
in the runtime database whose VIN number matches the parameter vin.
|
public VehicleManager()
vehicleDB
. This ArrayList will serve as the runtime
vehicle database.public java.util.ArrayList<Vehicle> getVehicleDB()
boolean verifyExistanceOfVin(java.lang.String vin)
vin
- The VIN number to search the database forboolean addVehicle(java.util.Scanner kb)
kb
- The scanner object used to read in from the consolepublic boolean deleteVehicle(java.lang.String vin)
addVehicle
method.vin
- The VIN number of the vehicle to be removed from the databaseboolean sellVehicle(java.util.Scanner kb, PersonManager userManager)
kb
- The Scanner object for console input and outputuserManager
- The user manager (for verifying customer/employee UID)int search(java.lang.String s)
s
- A string that is the VIN number of the vehicle being sought.public java.util.ArrayList<Vehicle> showPriceRange(double lower, double higher, java.lang.String type)
lower
- The lower limit of the price range to be searched.higher
- The upper limit of the price range to be searched.type
- The type of results to return (car, truck, motorcycle or all)public boolean saveVehicleDB()
public boolean saveSalesDB()
boolean readDB()
vehicles.db
and load each vehicle's info into the runtime database.vehicleDB
, false otherwise.boolean readSaleDB()
sales.db
and load each sale transaction's info into the runtime database.salesDB
, false otherwise.