Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Vector help

  Asked By: Bertha    Date: Jun 30    Category: Java    Views: 723
  

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.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Walborgd Fischer     Answered On: Jun 30

has anyone got any suggestions on this problem i have tried loads of
things and it needs to be in soon.

 
Didn't find what you were looking for? Find more on Vector help Or get search suggestion and latest updates.




Tagged: