In: Computer Science
NEED IN JAVA
Problem statement.
This application will support the operations of a technical library for an R&D organization. This includes the searching for and lending of technical library materials, including books, videos, and technical journals. Users will enter their company ids in order to use the system; and they will enter material ID numbers when checking out and returning items.
Each borrower can be lent up to five items. Each type of library item can be lent for a different period of time (books 4 weeks, journals 2 weeks, videos 1 week). If returned after their due date, the library user's organization will be charged a fine, based on the type of item ( books $1/day, journals $3/day, videos $5/day).
Materials will be lent to employees with no overdue lendables, fewer than five articles out, and total fines less than $100.
R & D Library books UnderstandingMathematics 0015B EngineeringAsAService 0012A FundamentalAlgorithms 0008A BigJava 0019C SortingAndSearching 0071A MathematicalComputations 0004B journals FeasibilityOfTheWeb X980 StudyOfAComet X324 ACaseStudyOfBehavioralActions X234 HowToKeepAJob X210 XgonGiveItToYa X821 videos TedTalkSeries 12.W LectureSeries 16.S
/*
* Program: LibraryReservation.java
*
* Author 1: FULL NAME
*
* Date: THE CURRENT DATE
* Course:
*
* Program Description:
*
* WRITE PROGRAM DESCRIPTION
*
*/
MaterialCard Class:
class MaterialCard{
private String books[];
private String journals[];
private String videos[];
private int totalFine;
private int b;
private int j;
private int v;
public MaterialCard(String books[],String journals[],String videos[]){
this.books=books;
this.journals=journals;
this.videos=videos;
}
public String[] getBooks(){
return books;
}
public String[] getJournals(){
return journals;
}
public String[] getVideos(){
return videos;
}
public void dueDates(int b,int j,int v){
this.b=b;
this.j=j;
this.v=v;
}
public int getFine(){
totalFine=books.length*b*1+journals.length*j*3+videos.length*v*5;
return totalFine;
}
}
Employee Class:
class Employee{
private String userName;
private int noOfItems;
private int totalFine=0;
public Employee(String userName,int noOfItems){
this.userName=userName;
this.noOfItems=noOfItems;
}
public String getUserName(){
return userName;
}
public int getNoOfItems(){
return noOfItems;
}
public void setEmplyoeeFine(){
this.totalFine=totalFine;
}
}
Main class: R&DLibrary
public class RDLibrary{
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
System.out.println("Welcome to library");
System.out.print("Enter your name:");
String name=sc.nextLine();
System.out.println("Enter number of items to lent(Should not be more than 5):");
int n=sc.nextInt();
Employee objE=new Employee(name,n);
System.out.print("Enter number of books you want to lent:");
int b=sc.nextInt();
sc.nextLine();
String book[]=new String[b];
for (int i=0;i<b;i++ ){
System.out.print("Enter Book "+(i+1)+" Name:");
book[i]=sc.nextLine();
}
System.out.print("Enter number of journals you want to lent:");
int j=sc.nextInt();
sc.nextLine();
String journal[]=new String[j];
for (int i=0;i<j;i++ ){
System.out.print("Enter journal "+(i+1)+" Name:");
journal[i]=sc.nextLine();
}
System.out.print("Enter number of videos you want to lent:");
int v=sc.nextInt();
sc.nextLine();
String videos[]=new String[v];
for (int i=0;i<v;i++ ){
System.out.print("Enter video "+(i+1)+" Name:");
videos[i]=sc.nextLine();
}
MaterialCard objM=new MaterialCard(book,journal,videos);
System.out.println("You are checked in!");
System.out.println("Now while checking out");
System.out.print("Enter the no of days due for books: ");
int b1=sc.nextInt();
System.out.print("Enter the no of days due for journals: ");
int j1=sc.nextInt();
System.out.print("Enter the no of days due for videos: ");
int v1=sc.nextInt();
objM.dueDates(b1,j1,v1);
System.out.println("Books you are returning: ");
for (int i=0;i<objM.getBooks().length;i++){
System.out.println(objM.getBooks()[i]);
}
System.out.println("Journals you are returning: :");
for (int i=0;i<objM.getJournals().length;i++){
System.out.println(objM.getJournals()[i]);
}
System.out.println("Videos you are returning");
for (int i=0;i<objM.getVideos().length;i++){
System.out.println(objM.getVideos()[i]);
}
objE.setEmplyoeeFine(objM.getFine());
System.out.println("Total fine is:"+objM.getFine());
System.out.println(objE.getUserName()+"You are checked out Thank you visit again");
}
}
Thank you! if you have any queries post it below in the comment section I will try my best to resolve your queries and I will add it to my answer if required. Please give upvote if you like it.