Currently I am working on a application which allows technical manuals to be added, stored, borrowed, returned to a virtual library.
Currently I am working on the section which allows the user to return a book they have previously borrowed. When they enter "4" at the main menu they will be displayed with a list of the currently borrowed manuals.
I have managed to get the borrowed manuals to display but I am also met with an error which quits my java application, shown here:
Here is the relevant code for this application (if I need to display more please let me know):
static void returnManual(){
System.out.printf("\n\nHere are the Manual/s currently out on loan:\n\n");
if(ManualList.get(ManualChoice).status.equalsIgnoreCase(status2) && borrowedManuals.size() >= ManualChoice){
for (int i = 0; i < borrowedManuals.size(); i++)
System.out.println(borrowedManuals.get(i).displayManual());
returnManualTitle = Console.readString(Messages.enterManualTitle, Messages.tooShortMessage, 3);
}
If anyone knows how this error can be resolved please let me know :) I am fairly new to Java!
UPDATE
I have applied the Christophers suggestion made in the comments to change ManualList.size() to borrowedManuals.size().
The issue now is that if the user borrows 2 manuals and wishes to return the second manual, their title entry is not activated once they enter the title name for the (second) manual they wish to return. If the first manual title is entered, the application functions as expected and returns the manual to the library.
Below is an example of this. I have also updated my code (above) to include the changes made.