as a requirement for my assignment my program must allow for
customers to have on loan more than one car or van. so far i can add
a customer to the customers vector - search through it and so on.
however i am having trouble with "what if the customer already
exists" here is some code. any help would be useful.
public void allocate(String name, int licenceNo, String regNo) {
Vector personalVector = new Vector(1,1);
customers.add(new Customer(name, licenceNo, personalVector));
personalVector.add(vector.get(findVehicle(regNo)));
for(int i = 0; i < personalVector.size(); i++) {
if(personalVector.get(i) instanceof Car) {
Car car = (Car)personalVector.get(i);
car.getStatus(ON_LOAN);
//notifyCarUpdate(car);
}
else if(personalVector.get(i) instanceof Van) {
Van van = (Van)personalVector.get(i);
//notifyVanUpdate(van);
}
}
}
NB: vector = the vector that all of the vehicles i.e. vans and cars
are stored in.