7/3/25, 11:24 PM Online Java Compiler | Java Editor
98 [Link](amount);
99 [Link]("You have successfully bo
100 } else {
101 [Link]("Not enough copies availa Input arguments
102 }
103 }
104
105 private static void returnBooks() {
106 [Link]("Enter book title to return: "
Interactive Mode: On
107 String title = [Link]().trim();
108
109 if () { Output Generated files
110 [Link]("This book does not belon
111 return;
112 }
113
====== Library Menu ======
114 [Link]("Enter number of copies to retu
1. Add Books
115 int amount = getPositiveIntegerInput();
2. Borrow Books
116
3. Return Books
117 [Link](title).returnBook(amount);
4. Exit
118 [Link]("You have successfully return
Choose an option (1-4): 1
119 }
Enter book title: Think and Grow Rich
120
Enter author name: Napoleon Hill
121 private static int getPositiveIntegerInput() {
Enter quantity: 1
122 int value = -1;
Book added successfully.
123 while (value < 0) {
124 try {
125 value = [Link]([Link]
====== Library Menu ======
126 if (value < 0) {
1. Add Books
127 [Link]("Please enter a non
2. Borrow Books
128 }
3. Return Books
129 } catch (NumberFormatException e) {
4. Exit
130 [Link]("Invalid input. Please
Choose an option (1-4): Invalid option
131 }
132 }
====== Library Menu ======
133 return value;
1. Add Books
134 }
2. Borrow Books
135 }
3 Return Books
136
Upgrade to Pro I need help
[Link] 1/1