You are on page 1of 17

A

PROJECT REPORT
On

“Phone Directory System”

Submitted to
Central Board of Secondary
Education In the practical fulfillment
of course “Higher Secondary
Certificate”
Sub: Information Technology

SUBMITTED BY
Mr. Prathmesh Dhanraj Landge

UNDER THE GUIDANCE OF


Prof.K. K. Ambre

VASUNDHARA ACADEMY,AKOLE
Tal. Akole – 422601 Dist.
Ahemdnagar
Certificate Provide by Ma’am
ACKNOWLEDGMENTS

Before we get into the thick of things I would like to add a few heartful words for who
were parts of this project in numerous ways, people who gave unending support rights the stage
and the project idea was conceived. The four thing things that go to make successful ends ever
are declaration hard work, patience and correct guidance our Principal Miss.Aparna
Shriwastav Madam. Able to timely guidance not only helps in making an effort faithful but also
transform the whole process of learning and implementing into to the enjoyable expertise. I
would like to thank support and guidance of Co-Ordinator Dr. Aditi Phapale Madam And
Prof. Kiran Ambre Sir. I expresses my sincere thanks to the entire faculty member of
Vasundhara Academy Akole. And finally heartfelt appreciations to those countless friends who
made me to delve deeper and deeper into the extent that I know firmly believe that experience is
an attitude, philosophy of life.
INDEX

Sr. No Topics

1 Introduction

2 Scope of the system

3 Need of the system

4 Source Code

5 Output

6 Advantages

7 Dis-Advantages

8 Future Enhancement
Need:
The code implements a simple phone directory system with basic functionalities
such as adding, searching, deleting, modifying phone numbers, and displaying the
phone directory. It aims to provide a user-friendly interface for managing contact
information.
Contact Management: The primary need is to manage and organize contact
information, including names and phone numbers, in a systematic manner.

User-Friendly Interface: A user-friendly interface is essential for users to interact


with the phone directory easily. The menu-driven console approach caters to
simplicity and ease of use.

Accessibility: The code fulfills the need for users to access and manipulate their
contact information conveniently, providing operations like adding, searching,
modifying, and deleting phone numbers.

Compact Solution: The code offers a compact solution for individuals or small
groups who require a straightforward phone directory without the complexity
of more advanced contact management systems.

Basic Operations: It addresses the fundamental operations needed for a


phone directory, such as adding new contacts, finding contact details, updating
phone numbers, and removing entries.

Capacity Management: The initialization with a specified capacity caters to the


need for managing a limited number of contacts. This suits scenarios where the
user wants to control the size of their phone directory.
Real-time Interaction: The program provides a real-time interaction environment
where users can make instant changes to their phone directory, reflecting the
dynamic nature of contact management.

Educational Purposes: The code serves as an educational tool, offering a clear


example of basic Java programming, array usage, and simple menu-driven console
applications. It can be used for learning and teaching programming concepts.

Prompt Feedback: Users receive immediate feedback on their actions, with


messages indicating success or failure, contributing to a responsive and user-
engaging experience.
Scope:
The scope of this code is limited to managing a fixed-size phone directory with a
specified capacity. It allows users to perform operations on the stored contact
information through a menu-driven console interface.
Limited Operations: The code supports basic phone directory operations, namely
adding, searching, deleting, modifying, and displaying entries. It focuses on
essential functionalities for managing contact information.

Console Interface: The scope is confined to a console-based user interface,


providing a straightforward interaction through the command line. It
doesn't include a graphical user interface (GUI) or web-based interface.

Single User: The design assumes a single-user environment, with no provisions


for concurrent access or user authentication. It suits personal use scenarios rather
than multi-user systems.

Input from Console: Interaction is solely through the console, with user
input acquired using a Scanner. There's no integration with external input
sources or more advanced input methods.

Primitive Data Types: The phone directory stores names and phone numbers as
arrays of strings. It doesn't utilize more advanced data structures or object-oriented
design, keeping the implementation simple.

Menu-Driven Approach: The program employs a menu-driven approach to guide


users through different operations. It relies on integer-based choices for simplicity.

Simple Error Handling: The error handling is basic, primarily focusing on


handling array boundaries. It doesn't extensively handle potential user input errors
or unexpected runtime issues.
In-Memory Storage: All phone directory data is stored in memory during
program execution. It doesn't persistently store data beyond the program's
lifecycle.

Single Class Implementation: The entire phone directory functionality is


encapsulated within a single class (PhoneDirectory). There's no separation of
concerns into multiple classes or modular components.

Fixed Capacity: The phone directory has a fixed capacity determined during
initialization. It doesn't support automatic resizing or dynamic adjustment based on
the number of entries.
Source Code:
import java.util.Scanner;

public class PhoneDirectory {


private String[] names;
private String[] phoneNumbers;
private int size;

public PhoneDirectory(int capacity) {


names = new String[capacity];
phoneNumbers = new String[capacity];
size = 0;
}

public void addPhoneNumber(String name, String phoneNumber) {


if (size < names.length) {
names[size] = name;
phoneNumbers[size] = phoneNumber;
size++;
System.out.println("Phone number added successfully for " + name);
} else {
System.out.println("Phone directory is full. Cannot add more entries.");
}
}
public void searchPhoneNumber(String name) {
for (int i = 0; i < size; i++) {
if (names[i].equals(name)) {
System.out.println(name + ": " + phoneNumbers[i]);
return;
}
}
System.out.println(name + " not found in the phone directory.");
}

public void deletePhoneNumber(String name) {


for (int i = 0; i < size; i++) {
if (names[i].equals(name)) {
// Shift elements to fill the gap
for (int j = i; j < size - 1; j++) {
names[j] = names[j + 1];
phoneNumbers[j] = phoneNumbers[j + 1];
}
size--;
System.out.println(name + "'s phone number deleted successfully.");
return;
}
}
System.out.println(name + " not found in the phone directory.");
}
public void modifyPhoneNumber(String name, String newPhoneNumber) {
for (int i = 0; i < size; i++) {
if (names[i].equals(name)) {
phoneNumbers[i] = newPhoneNumber;
System.out.println(name + "'s phone number modified successfully.");
return;
}
}
System.out.println(name + " not found in the phone directory.");
}

public void displayPhoneDirectory() {


System.out.println("Phone Directory:");
for (int i = 0; i < size; i++) {
System.out.println(names[i] + ": " + phoneNumbers[i]);
}
}

public static void main(String[] args) {


int capacity = 100; // Adjust the capacity based on your needs
PhoneDirectory phoneDirectory = new PhoneDirectory(capacity);
Scanner scanner = new Scanner(System.in);

while (true) {
System.out.println("\nPhone Directory Menu:");
System.out.println("1. Add Phone Number");
System.out.println("2. Search Phone Number");
System.out.println("3. Delete Phone Number");
System.out.println("4. Modify Phone Number");
System.out.println("5. Display Phone Directory");
System.out.println("6. Exit");

System.out.print("Enter your choice: ");


int choice = scanner.nextInt();
scanner.nextLine(); // Consume the newline character

switch (choice) {
case 1:
System.out.print("Enter name: ");
String addName =
scanner.nextLine();
System.out.print("Enter phone number: ");
String addPhoneNumber = scanner.nextLine();
phoneDirectory.addPhoneNumber(addName, addPhoneNumber);
break;

case 2:
System.out.print("Enter name to search: ");
String searchName = scanner.nextLine();
phoneDirectory.searchPhoneNumber(searchName);
break;

case 3:
System.out.print("Enter name to delete: ");
String deleteName = scanner.nextLine();
phoneDirectory.deletePhoneNumber(deleteName);
break;

case 4:
System.out.print("Enter name to modify: ");
String modifyName = scanner.nextLine();
System.out.print("Enter new phone number: ");
String newPhoneNumber = scanner.nextLine();
phoneDirectory.modifyPhoneNumber(modifyName,
newPhoneNumber);
break;

case 5:
phoneDirectory.displayPhoneDirectory();
break;

case 6:
System.out.println("Exiting the Phone Directory application.
Goodbye!");
System.exit(0);
default:
System.out.println("Invalid choice. Please enter a number between 1
and 6.");
}
}
}
}
Advantages:
Simplicity: The code is easy to understand and serves its purpose without
unnecessary complexity.
User Interaction: It provides a menu-driven interface, making it user-friendly for
interacting with the phone directory.
Memory Efficiency: The use of arrays for storing names and phone numbers
ensures memory efficiency, especially for a moderate number of entries.
Disadvantages:
Fixed Capacity: The phone directory has a fixed capacity, limiting the number
of entries. Dynamic resizing could enhance flexibility.
Linear Search: Searching, deleting, and modifying operations use a linear
search, which may become inefficient for a large number of entries. Implementing
a more efficient data structure (e.g., HashMap) would improve these operations.
Limited Error Handling: The code lacks extensive error handling,
potentially leading to unexpected behavior if users input invalid data.
Future Enhancements:
Dynamic Resizing: Allow the phone directory to dynamically resize to
accommodate more entries, ensuring scalability.
Improved Searching: Implement a more efficient search algorithm (e.g., binary
search for a sorted directory) to enhance performance.
Error Handling: Incorporate robust error handling to handle invalid user inputs
and unexpected situations gracefully.
File I/O: Integrate file input/output to persist the phone directory data, enabling
data retention across program executions.
Graphical User Interface (GUI): Develop a GUI for a more visually appealing
and user-friendly experience.
These enhancements would make the phone directory more versatile, efficient, and
robust in handling various scenarios.

You might also like