Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions

Question

Explain the process planning.

Answered: 1 week ago

Question

What do you mean by 'make or buy decision ' ?

Answered: 1 week ago