Hi all, im creating a system that manages stock, and I need to be able to do the following:
When customer rents X, data = number;
When customer returns X, data = number;
However I cannot work out how to overide the propertise I have alreaey stored in the object!
I am storing my objects in a vector and calling them at a later date.
I currently have it so, if they rent a car, the number stored is 1, if a bike its 2, etc, and I use if statements to work out what vehicle they have rented later in the program.
However I need to set it to 3, when they return the vehicle, to say that they are currently renting nothing, but trying to do this has no effect and I am just continualy told that the vehicle that they have returned is still rented by them....
I have tried to alter it like this but it seems to not work:
When customer rents X, data = number;
When customer returns X, data = number;
However I cannot work out how to overide the propertise I have alreaey stored in the object!
I am storing my objects in a vector and calling them at a later date.
I currently have it so, if they rent a car, the number stored is 1, if a bike its 2, etc, and I use if statements to work out what vehicle they have rented later in the program.
However I need to set it to 3, when they return the vehicle, to say that they are currently renting nothing, but trying to do this has no effect and I am just continualy told that the vehicle that they have returned is still rented by them....
I have tried to alter it like this but it seems to not work:
Code:
CustomerRecord customerRecord = (CustomerRecord) customer.get(selectNo);
if(customerRecord.getRented() == 1) {
System.out.println("The Customer Is Renting A Car, They Rented It For: " + customerRecord.getDuration() + " Hours");
customerRecord.getRented() = 4;
Last edited: