hello,
im working on a program that simulates a library, in this library there are 4 classes: llibrary, book, patron, and libraryMain.
In libraryMain, i'm using if statements to allow the user to input text into the menu, choosing different options. When i run the program, it runs through the if statements in order, so i cant enter something like "show patrons" without it executing the "invalid entry" string from the previous case.
i would like the to allow input for every set of cases at the same time without going in order.
im working on a program that simulates a library, in this library there are 4 classes: llibrary, book, patron, and libraryMain.
In libraryMain, i'm using if statements to allow the user to input text into the menu, choosing different options. When i run the program, it runs through the if statements in order, so i cant enter something like "show patrons" without it executing the "invalid entry" string from the previous case.
i would like the to allow input for every set of cases at the same time without going in order.
Code:
String input;
System.out.print("Enter a selection: ");
input = in.nextLine();
// add/remove books control
if (input.equalsIgnoreCase("add a book"))
{
System.out.println("Enter book to add: ");
}
else if (input.equalsIgnoreCase("remove book"))
{
System.out.println("Enter book to remove: ");
}
else
{
System.out.println("Invalid Entry");
}
System.out.print("Enter a selection: ");
Comment