Varnam Aayiram wrote: My suspicion is that the 'bookingConfirmed' method is being called after the while block is over, hence the writing to the table.
David Newton wrote: Can't you keep track of whether or not the slot's been taken and if it hasn't been, call the method?
Varnam Aayiram wrote:
...the while loop goes through the table and the if condition sees if the user's input values match any existing record in the table ( if(unique1.equals(unique2)) ) and when that is met, I am calling the slotTaken method. If the if condition is not met, it means there is no simillar booking, meaning the slot is free, so I than call the bookingConfirmed method.
Don't get me started about those stupid light bulbs. |