An Assignment (project) in java programming Write a code for library mangement s
ID: 3711980 • Letter: A
Question
An Assignment (project) in java programming Write a code for library mangement system you might use input validation and interface it should do the the functionalities : Add a book or journal Add a student or staff or faculty Borrow a book Return a book ......... etc An Assignment (project) in java programming Write a code for library mangement system you might use input validation and interface it should do the the functionalities : Add a book or journal Add a student or staff or faculty Borrow a book Return a book ......... etcLibrary Svstem Proiect The library at the University stores different items that can be borrowed, including books and journals. The library offers this service to university members who include: students, staff and faculty members, but only faculty members can borrow journals. Students can borrow up to a maximum of 5 books and staff can borrow up to a maximum of 7 books, and faculty member can borrow up to a maximum of 10 books and 3 journals. When a user borrows a book, they provide their Id, if this is valid their loan details are checked to ensure that they have not already borrowed above the maximum permitted number of books. The following is a brief class diagram that describes classes in this system and their relationships. Date day Borroweditem dateOfBorro Item callNumber SBN year Libraryltem ber Un iD name email Student Journal issuNo Book work-phone home-phone author2 author3 publisher Staff FacultyMember college rtment
Explanation / Answer
import java.awt.List;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.Collections;
public class Library
{
static ArrayList <Patron> UserList = new ArrayList<Patron>();
static ArrayList <String> BookList = new ArrayList <String> ();
public static String status;
public static String borrower;
public static String borrowDate;
public static String returnDate;
public String status1 = "Available";
public String status2 = "Borrowed";
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
int choice = 0;
System.out.println("********************Welcome to the Public Library!********************");
System.out.println(" Please Select From The Following Options: ");
System.out.println("**********************************************************************");
while(choice != 9)
{
System.out.println("1: Add new patron");
System.out.println("2: Add new book");
System.out.println("3: Edit patron");
System.out.println("4: Edit book");
System.out.println("5: Display all patrons");
System.out.println("6: Display all books");
System.out.println("7: Check out book");
System.out.println("8: Check in book");
System.out.println("9: Search book");
System.out.println("10: Search Patron");
System.out.println("9: Exit");
choice = input.nextInt();
switch(choice)
{
case 1: //Add new patron
System.out.print("Enter patron first name: ");
String firstName = input.next(); //read name from input
System.out.print("Enter patron last name: ");
String lastName = input.next();
UserList.add(new Patron(firstName, lastName)); //add name to list
System.out.println("-----You have successfully added a new patron!-----");
break;
case 2: //Add new book
System.out.print("Enter book title: ");
String title1 = input.next();
Scanner input1 = new Scanner(System.in);
System.out.print("Enter book author: ");
String author1 = input.next();
Book book1 = new Book(title1);
BookList.add(title1);
FullBookList.add(fullBook);
System.out.println("-----You have successfully added a new book!-----");
status = "available";
borrowDate = "none";
returnDate = "none";
borrower = "none";
break;
case 3: //Edit patron name
System.out.println("Enter original patron name: ");
String originalName = input.next();
System.out.println("Enter edited patron name: ");
String editedName = input.next();
//Collections.replaceAll(UserList, originalName, editedName);
if(UserList.contains(originalName))
{
}
case 4: //edit book
case 5: //display all patrons
System.out.println(UserList);
break;
case 6: //display all books
System.out.println(BookList);
break;
case 7: //check out a book
Patron.CheckOutBook();
break;
case 8: //check in a book
Patron.CheckInBook();
break;
}
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.