Java Micro
Java Micro
CERTIFICATE
This is certified that, the project report entitled “ library management system ”
Submitted by Sujal Sonawane{2215420044} ,Yash Puse {2215420055},Rohit Badak
{2215420114},Arya Kundalwal{2215240068},Mayank Kulkarni{2215420058}. Has
completed as per the requirement of Maharashtra State Board of Technical
Education in partial fulfilment of Diploma in Computer Science and Engineering.
DECLARATION
We hereby declare that we have performed, completed and written the project
entitled “ library management system”. It has not previously submitted for the
basis of the award of any other degree or diploma or other similar title of his for
any other diploma/examining body or university to the best of knowledge and
belief.
import java.util.*;
class Book {
private String title;
private String author;
private boolean isAvailable;
class Library {
private ArrayList<Book> books;
public Library() {
books = new ArrayList<>();
}
int choice;
do {
System.out.println("\nLibrary Management System");
System.out.println("1. Issue a book");
System.out.println("2. Return a book");
System.out.println("3. Display available books");
System.out.println("4. Exit");
System.out.print("Enter your choice: ");
choice = scanner.nextInt();
scanner.nextLine(); // Consume newline character
switch (choice) {
case 1:
System.out.print("Enter the title of the book to issue: ");
String issueTitle = scanner.nextLine();
library.issueBook(issueTitle);
break;
case 2:
System.out.print("Enter the title of the book to return: ");
String returnTitle = scanner.nextLine();
library.returnBook(returnTitle);
break;
case 3:
library.displayAvailableBooks();
break;
case 4:
System.out.println("Exiting...");
break;
default:
System.out.println("Invalid choice. Please try again.");
}
} while (choice != 4);
scanner.close();
}
}
Output