You are on page 1of 19

K L UNIVERSITY

FRESHMAN ENGINEERING DEPARTMENT


A Project Based Lab

Report On
Mini-Telephone Directory

SUBMITTED BY:

I.D NUMBER NAME

2200032865 SOWMYA

2200033008 MEGHANA

2200033055 BASIVIREDDY

2200033060 TEJASWI

UNDER THE ESTEEMED GUIDANCE OF

Mrs. G. Rajini Reddy


Asst. Prof. CSE

KL UNIVERSITY
Green fields, Vaddeswaram – 522 502
Guntur Dt., AP, India.

I
DEPARTMENT OF BASIC ENGINEERING SCIENCES

CERTIFICATE

This is to certify that the project based laboratory report entitled “MINI-TELEPHONE DIRECTORY”
submitted by Sowmya(2200032865), Meghana(2200033008), basivireddy(2200033055),
Tejaswi(2200033060)to the Department of Basic Engineering Sciences, KL University in partial
fulfillment of the requirements for the completion of a project in “Object Oriented Programming”
course in I B Tech II Semester, is a Bonafede record of the work carried out by Mrs. G. Rajini
Reddy under my supervision during the academic year 2022-23

PROJECT SUPERVISOR HEAD OF THE DEPARTMENT

Mrs. G. RAJINI REDDY Dr. D. HARITHA

II
ACKNOWLEDGEMENTS

It is great pleasure for me to express my gratitude to our honorable President Sri.


Koneru Satyanarayana, for giving the opportunity and platform with facilities in
accomplishing the project-based laboratory report.

I express the sincere gratitude to our director Dr. A Jagadeesh for his administration
towards our academic growth.

I express sincere gratitude to our Coordinator Dr. V. Krishna Reddy and HOD-BES
Dr. D. Haritha for her leadership and constant motivation provided in successful completion
of our academic semester. I record it as my privilege to deeply thank for providing us the
efficient faculty and facilities to make our ideas into reality.

I express my sincere thanks to our project supervisor Mrs. RAJINI REDDY for
his/her novel association of ideas, encouragement, appreciation and intellectual zeal which
motivated us to venture this project successfully.

Finally, it is pleased to acknowledge the indebtedness to all those who devoted


themselves directly or indirectly to make this project report success.

Project Associates

I.D NUMBER NAME

2200032865 SOWMYA

2200033008 MEGHANA

2200033055 BASIVIREDDY

2200033060 TEJASWI

III
ABSTRACT

A telephone directory commonly called a telephone book, telephone address book,


phone book, is a listing of telephone subscribers in a geographical area or subscribers to
services provided by the organization that publishes the directory. Its purpose is to allow the
telephone number of a subscriber identified by name and address to be found.

The advent of the internet and smart phones in the 21st century greatly reduced the need
for a paper phone book. Some communities, such as Seattle and San Francisco, soughtto ban
their unsolicited distribution as wasteful, unwanted and harmful to the environment.

1996 was the year the first telephone directories went online in the USA.
Yellowpages.com and Whitepages.com both saw their start in April. In 1999, the first online
telephone directories and people-finding sites such as LookUK.com went online in UK. In
2003, more advanced UK searching including Electoral Roll became available on
LocateFirst.com in the 21st century, printed telephone directories are increasingly criticized as
waste. In 2012, after some North American cities passed laws banning the distribution of
telephone books, an industry group sued and obtained a court ruling permitting the distribution
to continue.

IV
INDEX

S.NO TITLE PAGE NO

1 Introduction 1-2

2 Aim of the Project 3

2.1 Advantages & Disadvantages 3

2.2 Future Implementation 3

3 Software & Hardware Details 4

4 Class Diagram 5

5 Implementation 6-8

6 Outputs/Screenshots 9

7 Conclusion 10

V
INTRODUCTION
Class:

A class is a user defined blueprint or prototype from which objects are created. It
represents the set of properties or methods that are common to all objects of one type.

Methods:

A method is a collection of statements that perform some specific task and return the
result to the caller. A method can perform some specific task without returning anything.
Methods allow us to reuse the code without retyping the code. In Java, every method must be
part of some class which is different from languages like C, C++, and Python. Methods
are time savers and help us to reuse the code without retyping the code.

Objects:
It is a basic unit of Object-Oriented Programming and represents the real-life entities.
Hash Table:

This class implements a hash table, which maps keys to values. Any non-null object can be
used as a key or as a value. To successfully store and retrieve objects from a hash table, the
objects used as keys must implement the hash Code method and the equals method. It is like
HashMap but is synchronized. Hash table stores key/value pair in hash table.
In Hash table we specify an object that is used as a key, and the value we want to
associate to that key. The key is then hashed, and the resulting hash code is used as the index
at which the value is stored within the table.

1
Inheritance:
Inheritance is a mechanism in which one object acquires all the properties and
behaviors of a parent object. It is an important part of OOPs (Object Oriented programming
system). The idea behind inheritance is that you can create new
classes that are built upon existing classes.

Constructers:
Constructors are used to initialize the object’s state. Like methods, a constructor also
contains collection of statements that are executed at time of Object creation.

Abstract class:
An abstract class is a class that is declared abstract —it may or may not
include abstract methods. Abstract classes cannot be instantiated, but they can be subclass.
When an abstract class is subclass, the subclass usually provides implementations for all of
the abstract methods in its parent.

2
AIM

You are going to Create a Mini- Telephone Directory App. Develop a Mini Telephone Directory
based on user interface using Hash Table it adds contacts, display all contacts, search contacts
using name or number. All the options will we displayed when users try to interact with it.

Limitations: -

• They provide contact information.


• You can use a directory to get emergency help.
• Directories provide useful geographical information.
• You can use a directory to market your business.
• Basic Subscription to the service is free.

Drawbacks: -

• The main disadvantage of reverse phone directory is that, anyone who possesses your
cell number can easily look up to all personal details.
• Sometimes the information which is provided turns out to be the incorrect data.
• In case you own a cell number or an unlisted number, still the phone book companies
can list your all-personal information such as name, address, your email is etc.
• Also, it seen that there is irregular maintenance of the existing numbers.

Future Implementation: -

The next generation contact management solution needs to provide a few basic
services: portability, security, and syndication. There is a legitimate need for security and it
would be nice to be able to determine who can see your information and who can’t.

Yet we should also acknowledge the absolute security of contact data is quite
impossible for most of unless we spend a lot of money and time that we don’t have to secure
it. Finally, it should be so easy to use as a existing contact book or application that you use
today.

3
SOFTWARE & HARDWARE REQUIREMENTS:

➢ SOFTWARE REQUIREMENTS:
The major software requirements of the project are as follows:
Language : Java
Operating system: Windows Xp or later.

➢ HARDWARE REQUIREMENTS:
The hardware requirements that map towards the software are as follows:

RAM : 8 GB

Processor : i5 processor

4
CLASS DIAGRAM

5
IMPLEMENTATION:
package Java;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.HashMap;
import java.util.Map;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

public class PhoneDirectoryGUI implements ActionListener {

private JFrame frame;


private JPanel panel;
private JTextField nameField, phoneField;
private JButton addButton, deleteButton, lookupButton;
private Map<String, String> directory;

public PhoneDirectoryGUI() {
// Create directory
directory = new HashMap<>();

// Create frame

6
frame = new JFrame("Phone Directory");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

// Create panel
panel = new JPanel(new FlowLayout());

// Create name field


nameField = new JTextField(20);
panel.add(new JLabel("Name:"));
panel.add(nameField);

// Create phone field


phoneField = new JTextField(20);
panel.add(new JLabel("Phone:"));
panel.add(phoneField);

// Create add button


addButton = new JButton("Add");
addButton.addActionListener(this);
panel.add(addButton);

// Create delete button


deleteButton = new JButton("Delete");
deleteButton.addActionListener(this);
panel.add(deleteButton);

// Create lookup button


lookupButton = new JButton("Lookup");

7
lookupButton.addActionListener(this);
panel.add(lookupButton);

// Add panel to frame


frame.getContentPane().add(panel,
BorderLayout.CENTER);

// Display frame
frame.pack();
SetSize(400,400);
frame.setVisible(true);
}

private void SetSize(int i, int j) {


// TODO Auto-generated method stub

public static void main(String[] args) {


EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
new PhoneDirectoryGUI();
}
});
}

@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() == addButton) {
addContact();

8
} else if (e.getSource() == deleteButton) {
deleteContact();
} else if (e.getSource() == lookupButton) {
lookupContact();
}
}

private void addContact() {


String name = nameField.getText().trim();
String phone = phoneField.getText().trim();

if (name.isEmpty() || phone.isEmpty()) {
JOptionPane.showMessageDialog(frame, "Name and
phone number are required.");
return;
}

if (directory.containsKey(name)) {
JOptionPane.showMessageDialog(frame, "Contact
already exists.");
return;
}

directory.put(name, phone);
JOptionPane.showMessageDialog(frame, "Contact added:
" + name + " (" + phone + ")");

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

private void deleteContact() {


9
String name = nameField.getText().trim();

if (name.isEmpty()) {
JOptionPane.showMessageDialog(frame, "Name is
required.");
return;
}

String phone = directory.remove(name);


if (phone == null) {
JOptionPane.showMessageDialog(frame, "Contact not
found.");
} else {
JOptionPane.showMessageDialog(frame, "Contact
deleted: " + name + " (" + phone + ")");
}

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

private void lookupContact() {


String name = nameField.getText().trim();

if (name.isEmpty()) {
JOptionPane.showMessageDialog(frame, "Name is
required.");
return;
}
10
String phone = directory.get(name);
if (phone == null) {
JOptionPane.showMessageDialog(frame, "Contact not
found.");
} else {
JOptionPane.showMessageDialog(frame, "Phone
number for " + name + ": " + phone);
}
nameField.setText("");
phoneField.setText("");
}
}

11
OUTPUTS/SCREENSHOTS

12
13
CONCLUSION:

A telephone directory is one of the most useful tools of information in


communication. The traditional hard copy prints of the yellow and white pages have been
inexistence since 1878, and in late 20th century telephone address books went online.
From time to time we come across directories, whether in hard or soft print. Most people
however overlook their importance, sometimes due to lack of proper knowledge on their
use and benefits. Some of the least well-known telephone helplines are the Sky Helpline
and Tesco’s Helpline.

14

You might also like