You are on page 1of 28

VISVESVARAYA TECHNOLOGICAL UNIVERSITY

"JNANA SANGAMA", MACHHE, BELAGAVI-590018

File Structure Mini Project (18IS67)


On
TELEPHONE BILING MANAGEMENT
Submitted in partial fulfillment of the requirements for the VI semester
Bachelor of Engineering in
Information Science and Engineering of
Visvesvaraya Technological University, Belagavi by
ANSHUMAN KUMAR DWIVEDI 1CD20IS013
DIKSHA MANU 1CD20IS028
Under the Guidance of
Ms. Triveni N
Assistant Professor
Department of ISE

Department of Information Science and Engineering


CAMBRIDGE INSTITUTE OF TECHNOLOGY
K.R.PURAM, BANGALORE-560036
2022-2023
CAMBRIDGE INSTITUTE OF TECHNOLOGY
K.R. Puram, Bangalore-560 036
DEPARTMENT OF INFORMATION SCIENCE & ENGINEERING
CERTIFICATE

Certified that Mr. ANSHUMAN KUMAR DWIVEDI, Ms.DIKSHA MANU bearing USN
1CD20IS013, 1CD20IS028 a bonafide student of Cambridge Institute of Technology, has
successfully completed the File Structure Mini Project (18ISL67) entitled “TELEPHONE
BILLING MANAGEMENT” in partial fulfillment of the requirements for VI semester Bachelor
of Engineering in Information Science and Engineering of Visvesvaraya Technological
University, Belagavi during academic year 2022-2023. It is certified that all
Corrections/Suggestions indicated for Internal Assessment have been incorporated in the report
deposited in the departmental library. The File Structure Mini Project has been approved as it
satisfies the academic requirements prescribed for the Bachelor of Engineering degree.

Project Guide, Head of the Department,


Prof. Triveni N, Dr. Preethi S,
Dept. of ISE, CITech Dept. of ISE, CITech

Name of the Examiners Signature

1.

2.
ACKNOWLEDGEMENT

I would like to place on record my deep sense of gratitude to Shri. D. K. Mohan, Chairman,
Cambridge Group of Institutions, Bangalore, India for providing excellent Infrastructure and

Academic Environment at CITech without which this work would not have been possible.

I am extremely thankful to Dr. Indumathi G, Principal, CITech, Bangalore, for providing me the
academic ambience and everlasting motivation to carry out this work and shaping our careers.

I express my sincere gratitude to Dr. Preethi S, HOD, Dept. of Information Science and
Engineering, CITech, Bangalore, for her stimulating guidance, continuous encouragement and
motivation throughout the course of present work.

I also wish to extend my thanks to Project Guide, Prof. Triveni N, Assistant Professor, Dept. of
ISE, CITech for her critical, insightful comments, guidance and constructive suggestions to
improve the quality of the work and complete the project.

Finally to all my friends, classmates who always stood by me in difficult situations also helped me
in some technical aspects and last but not the least, I wish to express deepest sense of gratitude to
my parents who were a constant source of encouragement and stood by me as pillar of strength for
completing this work successfully.

ANSHUMAN KUMAR DWIVEDI 1CD20IS013


DIKSHA MANU 1CD20IS028
ABSTRACT

The Telephone Billing Management project is a Java-based application that allows users to manage
telephone records. It provides a user-friendly graphical interface to perform basic operations such
as inserting new records, deleting existing records, searching for specific records, modifying record
details, and displaying all the records.

The application stores the telephone records in a file using serialization. Each record consists of
attributes such as a telephone ID, customer name, phone number, and bill amount. The user can
input these details through text fields in the graphical interface.

The application stores the telephone records in a file using serialization. Each record consists of
attributes such as a telephone ID, customer name, phone number, and bill amount. The user can
input these details through text fields in the graphical interface.

When adding a new record, the application validates the phone number to ensure it is exactly 10
digits long and avoids duplicate records. The application also supports modifying existing records
by updating their attributes based on the provided information.

The user can search for records using the telephone ID and retrieve their details. In addition, the
application provides the functionality to delete records based on the telephone ID.

The application displays the records in a scrollable text area, allowing users to view all the records
or scroll through the displayed records.

i
CONTENTS

ABSTRACT i

CONTENTS ii

LIST OF FIGURES iii

CHAPTER NO. CHAPTER NAME PAGE NO.

Chapter 1 Introduction 1

Design, Algorithms and Requirements

2.1 Design
Chapter 2 2
2.2 Algorithm

2.3 Requirements

Chapter 3 Implementation 6

Chapter 4 Snapshots 17

Chapter 5 Conclusion and Future Enhancements 21

References 22

ii
LIST OF FIGURES

FIGURE NO. FIGURE NAME PAGE NO.

Figure 2.1 Flowchart 2

Figure 4.1 Home page 17

Figure 4.2 Inserting a record 17

Figure 4.3 Displaying the record 18

Figure 4.4 Deleting the record 18

Figure 4.5 Searching the record 19

Figure 4.6 Modifying the record 19

Figure 4.7 Redundant phone digits are not allowed 20

iii
CHAPTER 1
INTRODUCTION

The Telephone Billing Management project is a Java-based application developed to simplify the
management of telephone records. The aim of this project was to provide a user-friendly interface
and essential functionalities for organizing and maintaining telephone-related information.

The application allows users to perform various operations, including inserting new records,
deleting existing records, searching for specific records, modifying record details, and displaying
all records. It employs a file-based storage system using serialization to store the records efficiently.
Additionally, the application includes validation checks to ensure data integrity, such as preventing
duplicate entries and enforcing a 10-digit phone number format.

The Telephone Billing Management project offers a streamlined solution for handling telephone
records. It provides an intuitive graphical interface that simplifies the user experience. By
incorporating essential functionalities and implementing validation checks, the application
effectively meets the requirements of managing telephone-related information.

In conclusion, the Telephone Billing Management project demonstrates the capability of Java
programming in developing an efficient application for managing telephone records. With its user-
friendly interface, file-based storage, and validation checks, the application provides a convenient
and reliable solution for organizing and maintaining telephone-related data.

B.E., Dept. of ISE, CITech 2022-23 Page 1


CHAPTER 2
DESIGN, ALGORITHMS AND REQUIREMENTS

2.1 Design

FIG.2.1 Flowchart

User Interface -> Create/Edit/Search Note -> Save Note -> Display Note->delete Notes
The flow of notes nexus

B.E., Dept. of ISE, CITech 2022-23 Page 2


Telephone Billing Management Design, Algorithm and Requirements

2.2 Algorithm:

1. Start the application.


2. Initialize the notes data structure (e.g., ArrayList, HashMap) to store Note objects.
3. Load existing notes from the file system:
a. Check if a directory or file exists to store the notes.
b. If the directory or file exists:
i. Iterate over the files in the directory or open the file.
ii. For each file, read its content and create a Note object.
iii. Add the Note object to the notes data structure.
4. Create the main application window with UI components:
a. Create a GUI window (JFrame) with a title and layout.
b. Create UI components such as labels, text fields, buttons, and a text area.
c. Arrange the components in a visually appealing way.
5. Implement event listeners for UI components:
a. For each button or input field that requires user interaction:
i. Add an event listener to handle the corresponding action.
ii. Implement the necessary logic to respond to the user's action.
6. Implement logic for creating a note:
a. Retrieve the input from the title and content fields.
b. Check if a note with the same title already exists in the notes data structure.
c. If a note with the same title exists:
i. Display a confirmation dialog asking the user if they want to delete the
existing note or continue.
ii. If the user chooses to delete the existing note, remove it from the data
structure and delete its associated file.
d. Create a new Note object with the title and content.
e. Add the new Note object to the notes data structure.
f. Save the note content in a text file using the title as the filename.
g. Update the UI (e.g., refresh the notes list, clear the input fields).
7. Implement logic for selecting a note:
B.E, Dept. of ISE, CITech 2022-23 Page 3
Telephone Billing Management Design, Algorithm and Requirements

a. Retrieve the selected note from the notes data structure based on user input (e.g.,
selecting from a list, searching by title).
b. Display the note content in the input fields (e.g., populate the title and content fields
with the note's data).
8. Implement logic for modifying a note:
a. Retrieve the selected note from the notes data structure based on user input.
b. Update the note's content in the notes data structure.
c. Update the corresponding text file with the modified content.
9. Implement logic for deleting a note:
a. Retrieve the selected note from the notes data structure based on user input.
b. Prompt the user to confirm the deletion.
c. If the user confirms:
i. Remove the note from the notes data structure.
ii. Delete the associated text file.
iii. Update the UI (e.g., refresh the notes list, clear the input fields).
10. Handle errors and exceptions:
11. Implement error handling for file operations (e.g., file not found, permission denied).
12. Display appropriate error messages or dialogs to the user.
13. Test the application:
14. Create test cases for creating, modifying, and deleting notes.
15. Test the application's functionality and ensure it works as expected.
16. Finalize and deploy the application:

B.E, Dept. of ISE, CITech 2022-23 Page 4


Telephone Billing Management Design, Algorithm and Requirements

2.3 Requirements:

 Software Requirements:

 Java Development Kit (JDK): The project requires JDK to compile and run Java code.
 Integrated Development Environment (IDE): You can use any Java IDE such as Visual
Studio, IntelliJ IDEA, or NetBeans for development.
 Java Swing Library: This library is used for creating the graphical user interface (GUI)
components in the Note Taking App.
 Operating System: The project can run on any operating system that supports Java.

 Hardware Requirements:

 Processor: A modern processor capable of running the chosen operating system and Java
Virtual Machine (JVM).
 Memory (RAM): Sufficient RAM to run the operating system, the IDE, and the Note
Taking App simultaneously.
 Storage: Adequate storage space to store the application code, libraries, and any notes
saved as text files.
 4. Display: A monitor or screen to display the graphical user interface of the Note Taking
App.
 Input Devices: A keyboard and a mouse or other pointing device for user input.

These requirements are basic and can be met by most modern computers. However, depending on
the scale and complexity of the project, the actual hardware and software requirements may vary.
It's always a good practice to review the specific requirements of the tools and libraries you plan
to use and ensure that your hardware meets the minimum specifications.

B.E, Dept. of ISE, CITech 2022-23 Page 5


CHAPTER 3
IMPLEMENTATION

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;

class TelephoneRecord implements Serializable {


private int telephoneId;
private String customerName;
private String phoneNumber;
private double billAmount;

public TelephoneRecord(int telephoneId, String customerName, String phoneNumber, double


billAmount) {
this.telephoneId = telephoneId;
this.customerName = customerName;
this.phoneNumber = phoneNumber;
this.billAmount = billAmount;
}

public int getTelephoneId() {


return telephoneId;
}

B.E., Dept. of ISE, CITech 2022-23 Page 6


Telephone Billing Management Implementation

public void setTelephoneId(int telephoneId) {


this.telephoneId = telephoneId;
}

public String getCustomerName() {


return customerName;
}

public void setCustomerName(String customerName) {


this.customerName = customerName;
}

public String getPhoneNumber() {


return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {


this.phoneNumber = phoneNumber;
}

public double getBillAmount() {


return billAmount;
}

public void setBillAmount(double billAmount) {


this.billAmount = billAmount;
}

// Override toString() to provide a string representation of the record


@Override
public String toString() {
return "Telephone ID: " + telephoneId + "\n" +
B.E, Dept. of ISE, CITech 2022-23 Page 7
Telephone Billing Management Implementation

"Customer Name: " + customerName + "\n" +


"Phone Number: " + phoneNumber + "\n" +
"Bill Amount: " + billAmount;
}
}

class TelephoneBillingManagement extends JFrame {


private ArrayList<TelephoneRecord> records;
private File dataFile;
private JTextField idField, nameField, phoneField, billField;
private JTextArea displayArea;

public TelephoneBillingManagement() {
records = new ArrayList<>();
dataFile = new File("telephone_records.dat");

// Set up the JFrame


setTitle("Telephone Billing Management");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLayout(new FlowLayout());

// Create labels
JLabel idLabel = new JLabel("Telephone ID:");
JLabel nameLabel = new JLabel("Customer Name:");
JLabel phoneLabel = new JLabel("Phone Number:");
JLabel billLabel = new JLabel("Bill Amount:");

// Create text fields


idField = new JTextField(10);
nameField = new JTextField(10);
phoneField = new JTextField(10);
billField = new JTextField(10);

B.E, Dept. of ISE, CITech 2022-23 Page 8


Telephone Billing Management Implementation

// Create buttons
JButton addButton = new JButton("Add Record");
JButton deleteButton = new JButton("Delete Record");
JButton searchButton = new JButton("Search Record");
JButton modifyButton = new JButton("Modify Record");
JButton displayButton = new JButton("Display Records");

// Create display area


displayArea = new JTextArea(15, 30);
displayArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(displayArea);

// Add components to the JFrame


add(idLabel);
add(idField);
add(nameLabel);
add(nameField);
add(phoneLabel);
add(phoneField);
add(billLabel);
add(billField);
add(addButton);
add(deleteButton);
add(searchButton);
add(modifyButton);
add(displayButton);
add(scrollPane);

// Add action listeners to the buttons


addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
B.E, Dept. of ISE, CITech 2022-23 Page 9
Telephone Billing Management Implementation

addRecord();
}
});

deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
deleteRecord();
}
});

searchButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
searchRecord();
}
});

modifyButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
modifyRecord();
}
});

displayButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
displayRecords();
}
});

// Load records from file


loadRecordsFromFile();

// Set JFrame properties


B.E, Dept. of ISE, CITech 2022-23 Page 10
Telephone Billing Management Implementation

pack();
setLocationRelativeTo(null);
setVisible(true);
}

private void addRecord() {


int telephoneId = Integer.parseInt(idField.getText());
String customerName = nameField.getText();
String phoneNumber = phoneField.getText();
double billAmount = Double.parseDouble(billField.getText());

// Check for duplicate record


if (checkDuplicateRecord(phoneNumber)) {
displayArea.append("Duplicate record. Record not added.\n");
return;
}

// Validate phone number length


if (phoneNumber.length() != 10) {
displayArea.append("Invalid phone number. Phone number should be 10 digits long.\n");
return;
}

TelephoneRecord record = new TelephoneRecord(telephoneId, customerName, phoneNumber,


billAmount);
records.add(record);

saveRecordsToFile();

displayArea.append("Record added successfully.\n");

// Clear text fields


B.E, Dept. of ISE, CITech 2022-23 Page 11
Telephone Billing Management Implementation

clearTextFields();
}

private void deleteRecord() {


int telephoneId = Integer.parseInt(idField.getText());
TelephoneRecord recordToDelete = null;

for (TelephoneRecord record : records) {


if (record.getTelephoneId() == telephoneId) {
recordToDelete = record;
break;
}
}

if (recordToDelete != null) {
int deletedId = recordToDelete.getTelephoneId(); // Get the deleted telephone ID
records.remove(recordToDelete);
saveRecordsToFile();
displayArea.append("Record with Telephone ID " + deletedId + " deleted successfully.\n");
} else {
displayArea.append("Record not found.\n");
}

// Clear text fields


clearTextFields();
}

private void searchRecord() {


int telephoneId = Integer.parseInt(idField.getText());
TelephoneRecord foundRecord = null;

B.E, Dept. of ISE, CITech 2022-23 Page 12


Telephone Billing Management Implementation

for (TelephoneRecord record : records) {


if (record.getTelephoneId() == telephoneId) {
foundRecord = record;
break;
}
}

if (foundRecord != null) {
displayArea.append(foundRecord.toString() + "\n");
} else {
displayArea.append("Record not found.\n");
}

// Clear text fields


clearTextFields();
}

private void modifyRecord() {


int telephoneId = Integer.parseInt(idField.getText());
String customerName = nameField.getText();
String phoneNumber = phoneField.getText();
double billAmount = Double.parseDouble(billField.getText());

TelephoneRecord recordToModify = null;

for (TelephoneRecord record : records) {


if (record.getTelephoneId() == telephoneId) {
recordToModify = record;
break;
}
}

B.E, Dept. of ISE, CITech 2022-23 Page 13


Telephone Billing Management Implementation

if (recordToModify != null) {
// Display old record
displayArea.append("Old Record:\n" + recordToModify.toString() + "\n");

// Update record
recordToModify.setCustomerName(customerName);
recordToModify.setPhoneNumber(phoneNumber);
recordToModify.setBillAmount(billAmount);

saveRecordsToFile();

// Display new record


displayArea.append("New Record:\n" + recordToModify.toString() + "\n");
displayArea.append("Record modified successfully.\n");
} else {
displayArea.append("Record not found.\n");
}

// Clear text fields


clearTextFields();
}

private void displayRecords() {


if (records.isEmpty()) {
displayArea.append("No records found.\n");
} else {
for (TelephoneRecord record : records) {
displayArea.append(record.toString() + "\n\n");
}
}

// Clear text fields


B.E, Dept. of ISE, CITech 2022-23 Page 14
Telephone Billing Management Implementation

clearTextFields();
}

private void loadRecordsFromFile() {


if (dataFile.exists()) {
try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(dataFile))) {
records = (ArrayList<TelephoneRecord>) ois.readObject();
displayArea.append("Records loaded successfully.\n");
} catch (IOException | ClassNotFoundException e) {
displayArea.append("Failed to load records.\n");
}
} else {
displayArea.append("No records found.\n");
}
}

private void saveRecordsToFile() {


try (ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(dataFile))) {
oos.writeObject(records);
displayArea.append("Records saved successfully.\n");
} catch (IOException e) {
displayArea.append("Failed to save records.\n");
}
}

private boolean checkDuplicateRecord(String phoneNumber) {


for (TelephoneRecord record : records) {
if (record.getPhoneNumber().equals(phoneNumber)) {
return true;
}
}
return false;
B.E, Dept. of ISE, CITech 2022-23 Page 15
Telephone Billing Management Implementation

private void clearTextFields() {


idField.setText("");
nameField.setText("");
phoneField.setText("");
billField.setText("");
}

public static void main(String[] args) {


SwingUtilities.invokeLater(new Runnable() {
public void run() {
new TelephoneBillingManagement();
}
});
}

B.E, Dept. of ISE, CITech 2022-23 Page 16


CHAPTER 4
SNAPSHOTS

Fig 4.1 Home page

Fig 4.2 Inserting a record

B.E., Dept. of ISE, CITech 2022-23 Page 17


Notes Nexus Organizer Snapshots

Fig 4.3 Displaying the record

Fig 4.4 Deleting the record

B.E, Dept. of ISE, CITech 2022-23 Page 18


Notes Nexus Organizer Snapshots

Fig 4.5 Searching the record

Fig 4.6 Modifying the record

B.E, Dept. of ISE, CITech 2022-23 Page 19


Telephone Billing Management Snapshot

Fig 4.7 Redundant phone digits are


not allowed

B.E, Dept. of ISE, CITech 2022-23 Page 20


CHAPTER 5
CONCLUSION AND FUTURE ENHANCEMENTS
Conclusion:

The Telephone Billing Management application presented a user-friendly and efficient solution for
managing telephone records. Through its intuitive graphical interface, users could easily perform
operations such as adding, deleting, searching, modifying, and displaying records. The application
also incorporated file-based storage, allowing for the persistence of data across sessions. Overall,
the implementation using Java and the Swing library provided a reliable and accessible tool for
telephone billing management.

Future Enhancements:

To further enhance the Telephone Billing Management application, several future enhancements
could be considered. Firstly, implementing user authentication would bolster the security of the
application, ensuring that only authorized individuals can access and manage the records.
Additionally, enhancing data validation with comprehensive checks and error handling mechanisms
would improve data integrity and user experience.

Further improvements could involve incorporating sorting and filtering functionalities, enabling users
to organize and retrieve records based on various criteria. Integration with a database system, rather
than relying on file-based storage, would enhance scalability, reliability, and performance. This
change would allow the application to handle larger datasets and offer advanced data management
capabilities.

B.E., Dept. of ISE, CITech 2022-23 Page 21


REFERENCES

[1] Michael J. Folk, Bill Zoellick, Greg Riccardi : File Structures-An Object Oriented Approach
with C++, 3rd Edition, Pearson Education, 1998.
[2] K.R. Venugopal, K.G. Srinivas, P.M. Krishnaraj : File Structures Using C++, Tata McGraw-
Hill,2008.
[3] Scot Robert Ladd : C++ Components and Algorithms, BPB Publications, 1993.
[4] Raghu Ramakrishan and Johannes Gehrke : Database Management Systems, 3rd Edition,
McGraw Hill, 2003.

BIBLOGRAPHY
file:///C:/Users/91814/Downloads/NOTE%20NEXUS%20ORGANISER%20_.md
https://chat.openai.com/share/57a67822-970d-4012-b2e7-6eaae7e99707

B.E, Dept. of ISE, CITech 2022-23 Page 22

You might also like