Question
I have a method in a Helper class that is as follows: public int addReservation(Reservation aReservation) { int i = 0; int returnCode=1; //add code
I have a method in a Helper class that is as follows:
public int addReservation(Reservation aReservation)
{
int i = 0;
int returnCode=1;
//add code here:
if(reservationList.size() > 0)
{
while(returnCode == 1)
{
if(aReservation.getReservationDateTime().getTime() < reservationList.get(i).getReservationDateTime().getTime())
{
reservationList.add(i, aReservation);
returnCode = 0;
}
}
}
else
{
reservationList.add(aReservation);
returnCode = 0;
}
return returnCode;
}
reservationList is a linkedList. Whenever I try to add a reservation in the program, it appears that the reservation is not found. How can I resolve this issue?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started