Java Lab Exam Example
You are asked to develop a Library system demo for the librarian. The system should allow the following functions:
Two classes are defined for the implementation.
Book.java
Library.java
First, Library.java is:
import java.awt.List;
import java.util.ArrayList;
import java.util.Scanner;
public class LibraryManagement {
Scanner sc= new Scanner(System.in);
ArrayList<Book> bookinfo=new
ArrayList<Book>();
String bookNeeded="";
public void checkInBooks() {
Book b=new Book();
System.out.println("Enter the title
of book");
b.setTitle(sc.next());
System.out.println("Enter the price
of book");
b.setPrice(sc.nextInt());
System.out.println("Enter the count
of book to be checked in");
b.setCount(sc.nextInt());
bookinfo.add(b);
}
public void listBooks() {
System.out.println("title price
count ");
for(Book b:bookinfo) {
System.out.println(b.getTitle()+" "+b.getPrice()+"
"+b.getCount());
}
}
public void borrow() {
System.out.println("Enter the title
of book to be borrowed");
bookNeeded=sc.next();
System.out.println("Enter the count
of books to be borrowed");
int countNeeded=sc.nextInt();
for(Book b:bookinfo) {
{
if(b.getTitle().equalsIgnoreCase(bookNeeded))
{
if(b.getCount()>=countNeeded) {
System.out.println("Please collect your books");
int
newCount=b.getCount()-countNeeded;
b.setCount(newCount);
}
else {
System.out.println("Sry, We have less count of required
books");
}
}
}
System.out.println("Current Inventory is :");
listBooks();
}
}
public void returnBook() {
for(Book b:bookinfo) {
if(b.getTitle().equalsIgnoreCase(bookNeeded)) {
b.setCount(b.getCount()+1);
}
}
System.out.println("After return
this book count is :");
listBooks();
}
public static void main(String[] args) {
// TODO Auto-generated method
stub
LibraryManagement lb=new
LibraryManagement();
lb.checkInBooks();
lb.listBooks();
lb.borrow();
lb.returnBook();
}
}
Book.java is:
public class Book {
private String title="";
private int price=0;
private int count=0;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
output when the Library.java is ran is:

Java Lab Exam Example You are asked to develop a Library system demo for the librarian....
Subject: Java Program You are writing a simple library checkout system to be used by a librarian. You will need the following classes: Patron - A patron has a first and last name, can borrow a book, return a book, and keeps track of the books they currently have checked out (an array or ArrayList of books). The first and last names can be updated and retrieved. However, a patron can only have up to 3 books checked out at...
In this assignment you will implement software for your local library. The user of the software will be the librarian, who uses your program to issue library cards, check books out to patrons, check books back in, send out overdue notices, and open and close the library. class Calendar We need to deal with the passage of time, so we need to keep track of Java. Declare this variable as private int date within the class itself, not within any...
You need to program a simple book library system. There are three java classes Book.java // book object class Library.java //library class A2.java //for testing The Book.java class represents book objects which contain the following fields title: a string which represents the book title. author: a string to hold the book author name year: book publication year isbn: a string of 10 numeric numbers. The book class will have also 3 constructors. -The default no argument constructor - A constructor...
In this project, you will construct an Object-Oriented framework for a library system. The library must have books, and it must have patrons. The patrons can check books out and check them back in. Patrons can have at most 3 books checked out at any given time, and can only check out at most one copy of a given book. Books are due to be checked back in by the fourth day after checking them out. For every 5 days...
IN C++ My project will be a library management system. It will have seven functions. It HAS to contain: classes, structures, pointers and inheritance. fix code according to below 1. Add a new book allows the user to enter in book name and book code Book code has to be in # “Invalid book code” “book name has been added to library” book code will be used to borrow books 2. Add a new user must use first user must...
Lab 4: Java Fundamentals, Part IV In this assignment, you solve a conversion problem similar to Programming Challenge 1 of Chapter 3 of your text, page 184 (187 in Edition 5). Given one of the Roman numerals I, II, III, IV, V, VI, VII, VIII, IX, X, XI, XII, XIII, XIV, XV as an input your program must determine and display the corresponding decimal digit 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15....
IN C++ add Inheritance, Class and Pointers to program This is a library management program, users can borrow books and return books. Just incorporate the use of Inheritance, Class and Pointers into this program. The program should work the same after your edits. #include using namespace std; //structure to store library data struct library { int code; char title[20]; int status; }; //structure to store user data struct users { int id; char name[20]; int booksNumber; }; int main() {...
The primary keys are underlined.
The foreign keys are denoted by asterisks (*).
Description of the schema:
• person — keeps track of the people who borrow books from the
library. The attributes contain personal and contact
information.
• author — keeps track of personal information about authors.
• publisher — keeps track of the publisher information. To keep it
simple, most of the attributes have been truncated in the sample
database. 1 trivial dependencies are things like X→X or...
Can somebody help me with the Use Case Diagram . I am confused of what I am suppose to do. Here are the instructions : Your team should produce a Use Case Diagram and the associated Use Case Descriptions/Narratives for all the use cases in the diagram. The resulting document should havethe “professional look” and produced by a word processor, graphics/presentation/drawing software, and/or a CASE tool (e.g., Microsoft Word, Microsoft PowerPoint, ArgoUML, Dia, Visual Paradigm, Visio, etc.). All project documentation...
IN C++ Help to fix code Library management program. Error is when i type a letter into options menu the code breaks. after your edits, the code should still run as normal. CODE: #include<iostream> using namespace std; //structure to store library data class BookDetails{ public: struct library { int code; char title[20]; int status; }; library book_details[100]; }; //structure to store user data class UserDetails:public BookDetails{ public: struct users { int id; char name[20]; int booksNumber; }; users user_details[100]; };...