0% found this document useful (0 votes)
62 views20 pages

Library Fine Calculator

Uploaded by

Saradha S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views20 pages

Library Fine Calculator

Uploaded by

Saradha S
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Seth P.D.

Hinduja
Sindhi Model Senior Secondary School
(Affiliated to the Central Board of Secondary Education, Delhi)

No1, Damodaran Street, Kellys, Chennai – 600 010.


Phone : 044 – 26442454

e-mail : [email protected] / Website : www.sindhimodel.in

Roll No:

ALL INDIA SENIOR SCHOOL CERTIFICATE EXAMINATION

2024 - 2025
DEPARTMENT OF: INFORMATION TECHNOLOGY

1|Page
Seth P.D. Hinduja

(Affiliated to the Central Board of Secondary Education, Delhi)

No. 1, Damodaran Street, Kellys, Chennai – 600 010.


Phone : 044 – 26442454
e-mail : [email protected] / Website : www.sindhimodel.in

DEPARTMENT OF : INFORMATION TECHNOLOGY

This is to certify that ………………………………..…of Class…………………………… has

performed………………………………………during the year 2024 – 2025 at the school

laboratory: and that his / her project is certified as bonafied.

His / her examination Roll. No. is ……………………………….. .

Chennai – 600010 ………………………

Date ………… Head of the Department


Information Technology

_
Submitted for the All-India Senior School Certificate Examination
2024 – 2025(Practical Examination) in Information
Technology(802) Seth P.D. Hinduja Sindhi Model Senior
Secondary School, Chennai.

………………… ………………….

Practical Examiner -1 Practical Examiner - 2

2|Page
Date :…………… Date :………………

TABLE OF CONTENTS

S.NO Topic Name Page No.


1 CERTIFICATE 4

2 ACKNOWLEDGEMENT 5

3 PROJECT DESCRIPTION 6

4 SYSTEM ANALYSIS 4

5 SYSTEM DESIGN 5

6 PRACTICAL ANALYSIS 6

7 PROGRAM 7

8 OUTPUT SCREENS 18
9 CONCLUSION 23

10 BIBLIOGRAPHY 24

3|Page
CERTIFICATE

This is to certify that the project titled, “<Project Title>” is a piece of

work done by <Name of the student> of class XII – <sec>, in partial

fulfillment of CBSE All India Secondary School Examination

2024-2025 and has been carried out under my supervision and

guidance. This report or an identical report on this topic has not been

submitted for any other examination and does not form a part of any

other course undergone by the candidate.

..............................

Signature of Teacher/Guide

4|Page
ACKNOWLEDGEMENT

The successful completion of this project would not have been possible
without the unwavering support and encouragement of many individuals,
to whom I am deeply grateful.

First and foremost, I would like to thank God for providing me with the
strength, wisdom, and ability to successfully complete this project.

I would like to extend my heartfelt gratitude to Smt. Victoria D, our


respected Principal, for her constant support and for creating an
environment conducive to learning. A special thank you goes to my
Information Technology teacher, Smt. A. Saradha, whose invaluable
guidance, insightful suggestions, and encouragement were pivotal in
shaping the project. Her expertise and continuous support were key
factors in ensuring the success of this endeavour.

I am also immensely grateful to my parents and friends, whose belief in


me and constant encouragement have been a source of motivation. Their
constructive suggestions and help in various stages of the project were
instrumental in refining my ideas and ensuring smooth progress.

I extend my sincere thanks to everyone who supported me in any way


during the course of this project. Their contributions have been a
significant part of this success, and I am forever appreciative of their help
and presence.

5|Page
PROJECT DESCRIPTION
Library Fine Calculator

The Library Fine Calculator is a Java-based application designed to

help librarians and users easily calculate overdue fines for books. The

program stores details such as the book ID, title, due date, and return

date. If a book is returned after the due date, a fine of ₹5 per day is

calculated and displayed. The application uses Java's date handling and

formatting features to manage due dates and calculate fines accurately.

Features of Library Fine Calculator:

 Fine Calculation:
Automatically calculates a fine of ₹5 per day if a book is returned late.
 Date Validation:
Ensures correct date format (dd-MM-yyyy) and handles errors for invalid dates.
 Book Record Management:
Allows storing multiple book entries with details like book ID, title, due date, return
date, and fine.
 User-Friendly Menu:
Simple menu options for adding book details, displaying fines, and exiting the
application.
 Accurate Results:
Uses date difference to correctly calculate the number of days a book is overdue.

6|Page
System Analysis:
Problem Definition:
In libraries, calculating fines for overdue books manually can be time-consuming
and prone to errors. This project aims to simplify the process by providing an
automated way to calculate and display fines based on the return date of the book.
Proposed Solution:
The proposed solution is a console-based Java application where users can:
Enter the details of borrowed books, including due and return dates.
Automatically calculate fines based on the number of days a book is overdue.
Display the fine details for each book.
Software Requirements:
Programming Language: Java
Development Environment: NetBeans IDE
Java Version: JDK 8 or above
Operating System: Windows 11 Pro
Hardware Requirements:
Processor: Intel Core i7-11700 @ 2.50 GHz
RAM: 8 GB
Storage: At least 1 GB of free space
Functional Requirements
The system should fulfill the following key requirements:
 Add Book Details:
User can enter book information like Book ID, Title, Due Date, and Return Date.
 Check Date Format:
System verifies that dates are entered correctly (dd-MM-yyyy format).
 Calculate Fine:
System calculates a fine of ₹5 per day if the book is returned after the due date.
 Store Records:
System stores details of all entered books along with their calculated fines.

7|Page
 Show Fine Details:
System can display the list of all books with their fine amounts.
 User Menu:
Provides options to add book details, view fines, or exit the program.
Non-Functional Requirements
Usability : The system should be simple and easy to use with a clear, text based
menu.
Performance : The application should handle basic book management operations
quickly, even with a few hundred records.
Reliability : The system should provide accurate updates of book availability.
Maintainability : The code should be modular and easy to update or extend with
additional features.

System Design
Class Design
Book
bookId: String
title: String
dueDate: String
returnDate: String
fine: double

LibraryFineCalculator
books: ArrayList<Book>
scanner: Scanner
main(String[]): void
addBookDetails(): void
displayFineDetails():
void

8|Page
Practical Analysis:
The program efficiently handles date parsing and calculation of the difference
between due and return dates using the SimpleDateFormat class. It also uses an
ArrayList to store multiple book records, ensuring dynamic handling of book
entries. Error handling is implemented for incorrect date formats using
ParseException.
Key Features:
Automated fine calculation.
User-friendly input and output prompts.
Error handling for invalid date entries.
Simple and efficient code structure using Object-Oriented Programming (OOP).

Steps to Create the Project in NetBeans:


Step 1: Create a New Java Project
1. Open NetBeans IDE .
2. Go to File > New Project .
3. Select Java Application , then click Next .
4. Enter the project name (e.g., ` Library Fine Calculator System `), and click
Finish
Step 2: Create a Main Java Class
Create a new Java class file named ` Library Fine Calculator System .java`.
Step 3: Code for Library Fine Calculator System
Progran:
package libraryfinecalculator;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Scanner;

class Book {

9|Page
private String bookId;
private String title;
private String dueDate;
private String returnDate;
private double fine;
// Constructor
public Book(String bookId, String title, String dueDate, String returnDate) {
this.bookId = bookId;
this.title = title;
this.dueDate = dueDate;
this.returnDate = returnDate;
this.fine = calculateFine();
}
// Method to calculate fine based on the number of days late
private double calculateFine() {
SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
try {
Date due = sdf.parse(dueDate);
Date returned = sdf.parse(returnDate);
// Calculate the difference in milliseconds
long differenceInMilliSeconds = returned.getTime() - due.getTime();
long daysLate = differenceInMilliSeconds / (1000 * 60 * 60 * 24);
// Fine is Rs. 5 per day if the book is returned late
return (daysLate > 0) ? daysLate * 5 : 0;
} catch (ParseException e) {
System.out.println("Invalid date format. Please use dd-MM-yyyy.");
return 0;
}
}

10 | P a g e
public String toString() {
return "Book ID: " + bookId + ", Title: " + title +
", Due Date: " + dueDate + ", Return Date: " + returnDate +
", Fine: ₹" + fine;
}
}
public class LibraryFineCalculator {
private static ArrayList<Book> books = new ArrayList<>();
private static Scanner scanner = new Scanner(System.in);
public static void main(String[] args) {
int choice;
do {
System.out.println("\nLibrary Fine Calculator");
System.out.println("1. Enter Book Details");
System.out.println("2. Display Fine Details");
System.out.println("3. Exit");
System.out.print("Enter your choice: ");
choice = scanner.nextInt();
scanner.nextLine(); // Consume newline
switch (choice) {
case 1: addBookDetails(); break;
case 2 : displayFineDetails();break;
case 3 : System.out.println("Exiting the system. Goodbye!");break;
default : System.out.println("Invalid choice! Please try again.");
}
} while (choice != 3);
}

// Method to add book details

11 | P a g e
private static void addBookDetails() {
System.out.print("Enter Book ID: ");
String bookId = scanner.nextLine();
System.out.print("Enter Book Title: ");
String title = scanner.nextLine();
System.out.print("Enter Due Date (dd-MM-yyyy): ");
String dueDate = scanner.nextLine();
System.out.print("Enter Return Date (dd-MM-yyyy): ");
String returnDate = scanner.nextLine();
Book book = new Book(bookId, title, dueDate, returnDate);
books.add(book);
System.out.println("Book details added successfully!");
}
// Method to display fine details
private static void displayFineDetails() {
if (books.isEmpty()) {
System.out.println("No book records found.");
} else {
System.out.println("\nFine Details:");
for (Book book : books) {
System.out.println(book);
}
}
}
}
Step 4: Run the Project
1. Right click on Library Fine Calculator System .java
2. Select Run File or press `Shift F6`.

12 | P a g e
Project Explanation:

Library Fine Calculator System


The Library Fine Calculator System is a simple application designed to help
manage library books and calculate fines for overdue returns. The project helps
automate the process of tracking overdue books and calculating the fines, saving
time and reducing errors.

How It Works:
1. Entering Book Details:
- The user can enter information about a book, including:
- Book ID : A unique identifier for the book.
- Book Title : The title of the book.
- Due Date : The date by which the book should be returned (in dd-MM-yyyy
format).
- Return Date : The actual date when the book is returned (also in dd-MM-yyyy
format).
2. Fine Calculation:
- The system checks the Due Date and Return Date to calculate the fine.
- If the book is returned after the due date, a fine of ₹5 per day is applied.
- If the book is returned on time, there is no fine.
3. Storing Book Records:
- The system stores the entered book details and the calculated fine in a list.
- This list is used to keep track of multiple books and their overdue fines.
4. Displaying Fine Details:
- The user can view a list of all books entered, including their ID, title, due date,
return date, and the calculated fine.
- This helps the user easily check the fine status for each book.

13 | P a g e
5. User Interaction:
- The application runs in a simple, menu-driven interface. The user can:
- Enter Book Details : Input new book information.
- Display Fine Details : View the list of books and their fines.
- Exit : Close the application.
6. Error Handling:
- The system ensures correct date format (dd-MM-yyyy). If a user enters an
invalid date, an error message is shown.
- The system also handles invalid menu choices, prompting the user to try again.
Why This System?
The Library Fine Calculator System simplifies the task of managing overdue books
and fines. Instead of manually calculating fines or using paper records, this system
automates the entire process, ensuring accurate results and reducing errors. It
provides a user-friendly way for library staff or users to manage book returns and
fines efficiently.
This project is designed for ease of use, ensuring that users can quickly enter book
details, calculate fines, and view results.

14 | P a g e
OUTPUT SCREENS

1. Main Menu:

2. Enter Book Details:

15 | P a g e
3. Display Fine Details:

4. Invalid Date Format:

16 | P a g e
5. Exit:

17 | P a g e
Conclusion:

Conclusion:

The Library Fine Calculator project successfully demonstrates the use of Java for

handling real-world problems in a library management system. The program's

ability to parse dates, calculate fines, and handle user inputs showcases the strength

of Java's utility classes and Object-Oriented Programming principles. This project is

a practical solution for librarians to quickly and accurately calculate fines, reducing

manual effort and errors.

Future Enhancements:

Adding a graphical user interface (GUI) for a better user experience.

Extending the system to support multiple libraries and user accounts.

Integrating with a database for persistent storage of book records.

18 | P a g e
BIBLIOGRAPHY

19 | P a g e
20 | P a g e

You might also like