Java Project

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 11

Library Management System

1.0 Aims of the Micro-Project :

The purpose of this project is to use various concepts of java and develop a program.

2.0 Course Outcomes Address :

• We learnt object oriented methodology.


• To use concepts.
• To develop our logic in right sense.

3.0 Proposed Methodology :

When we decided to do this micro-project first we search the information


about The topic with the help of Internet. And we developed the program and the report.
Finally we made our project with Good co-ordination and Hardworking.

4.0 Resources Required :

S. No. Name of Resource/material Specifications Qty Remarks


1 Software Intellij -
2 Laptop Windows 2010 1

Library Management System


1.0 Rationale :
Java is object-oriented language means it follows a programming style that includes
concept such as class, object, inheritance and much more. This enhances the coding structure
making java highly relatable. Additionally, developing OOP based apps is easier as it helps
keeps the system flexible and sustainable.

2.0 Aims of Micro-Project :


The purpose of this project is to use various concepts of java and develop a program.

3.0 Course Outcomes Addressed :

• We learnt object oriented methodology.


• To use concepts.
• To develop our logic in right sense.

4.0 Literature Review :


www.wikipedia.com
www.javatpoints.com
www.google.com

5.0 Actual Methodology Followed :

When we decided to do this micro-project first we search the information


about The topic with the help of Internet. And we developed the program and the report.
Finally we made our project with Good co-ordination and Hardworking.
.
6.0 Actual Resources Used :

S. Name of Specifications Qty Remarks


No. Resource/material
1 Intellij-idea -
Windows 10
2 Refrence books Tech-Max 1

7.0 Skill Developed / Learning outcome of this Micro-Project :

From this project we came to know about many different concepts in java.

8.0 Applications of this Micro-Project :

Application of this project is that we can use this library management in an library.

A project report

Program code:
package com.company;
import java.util.Scanner;
import java.util.ArrayList;
abstract class Book{
int noOfBooks = 0;
ArrayList<String> array = new ArrayList<>();
Scanner sc = new Scanner(System.in);

abstract void register();

void addBook(){
System.out.println("Enter the book name you want to add: ");
String temp = sc.nextLine();
array.add(temp); noOfBooks++;
System.out.println("Book has be successfully added");
this.displayBooks();
}
void displayBooks(){
System.out.println("The list of available books is: ");
for (String item: this.array) { if (item == null){
continue;
}
System.out.println(" * " +item);
}
}
}
class Library extends Book{
ArrayList<String> names = new ArrayList<>();
@Override
void register(){
System.out.println("Enter your name: ");
names.add(sc.nextLine());
//sc.nextLine();
System.out.println("** Registration successful **");
}
void displayUsers(){
System.out.println("Displaying all the registered people");
for (String name: names){
System.out.println(" * "+name);
}
}
void issueBook(){
System.out.println("Enter the name of book you want to issue: ");
String bookName = sc.nextLine(); //sc.nextLine();
System.out.println("Enter the name who wants to issue the book:
"); String name = sc.nextLine();

for (int i = 0; i < noOfBooks; i++){


if (array.contains(bookName) && names.contains(name)){
System.out.println(bookName+" issued successfully to
"+name);
array.remove(bookName);
}
}
}
void returnBook(){
System.out.println("Enter the book name you want to return: ");
String returnName = sc.nextLine();
array.add(returnName);
System.out.println(returnName+ " book has be returned
successfully");
}
}
public class LibraryManagement {
public static void main(String[] args) {

Library l1 = new Library();


Scanner sc = new Scanner(System.in);
int choice = 0;
System.out.println("Welcome to the Library!!");
System.out.println("Choose the task you want to perform");
System.out.println("1. Register");
System.out.println("2. Add Book");
System.out.println("3. Issue Book");
System.out.println("4. Return Book");
System.out.println("5. Display All Available Books");
System.out.println("6. Display Registered people");
while (true) {
System.out.println("Enter your choice: ");
choice = sc.nextInt(); if (choice == 1)
{ l1.register(); }
else if (choice == 2) {
l1.addBook();
} else if (choice == 3) {
l1.issueBook(); } else if
(choice == 4) {
l1.returnBook(); } else
if (choice == 5) {
l1.displayBooks(); } else
if (choice == 6) {
l1.displayUsers();
} else {
System.out.println("Invalid choice");
}
}
}
}
Program output:
Concepts used in program:

1. Import java.util.Scanner: This means import the scanner class which is


defined inside util folder inside java folder. And it is the easiest way to read
input in java.

2. Import java.util.ArrayList: Array List is a dynamic data structure; it provides


constant time for search operation.

3. Class: A class is used to describe one or more objects.

4. Abstract Class: Abstract class is a restricted class that cannot be used to create
objects (to access it, it must be inherited from another class).

5. Abstract Method: Abstract method can only be used in an abstract class, and
it does have any body. The body is provided by the subclass (inherited from).

6. System.out.println: To print the output.

7. Public static void main (string [] args): Public static void main (string [] args)
is java main method and is the entry point of any java program.

8. Object: Each object is an instance of a particular class or subclass with the


class’s own methods or procedures and data variables.

9. Method: A method is a block of code which only runs when it is called. You
can pass data, known as parameters, into a method. They are also known as
functions.

Working of program:
When the program starts to execute it first goes to main method called public
static void main (Strings [] args) and then it takes the input from user.

Then you have to enter your choice from

• Register
• Addbook
• Issuebook
• Returnbook
• Display All Available Books
• Display Registered people

After you have entered your choice then while loop gets started. It calls the
various method that we have used in our program.

Methods used in program:

• add (); = To add books in the library.


• displayBooks (); = To display the available books.
• Register (); = To enter the name of user.
• displayusers (); = To display the names of users.
• Issuebook (); = The book which you want to issue and who wants to
issue.
• Returnbook (); = To return the book.

Conclusion:
We developed a small software using java about library management system.
Reference:
www.google.com
www.javatpoint.com
www.wschoolsjava.com

You might also like