JPR Microproject

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

BHARATI VIDYAPEET Institute Of Technology(Polytechnic),Navi

Mumbai

(Academic Year-2022-2023)
(Micro-project)
Software Engineering

Program-CM4I Course and Code-JPR(22412)

TOPIC:- Contact Number Book.

Submitted By :-
Hitesh rana ( 8846)
Kapil dongare (8845)
Sarthak binewale (8844)
Introduction:-
The Contact Number Book microproject involves
creating a digital book that stores the contact
details of individuals or businesses. This
microproject aims to provide a convenient and
organized way of storing and accessing contact
information. In this report, we will discuss the
implementation of the Contact Number Book in
Core Java.

Methodology:-
The Contact Number Book microproject was
implemented using Core Java programming
language. The program uses a file-based system to
store the contact information. The application
allows users to add new contacts, view existing
contacts, search for specific contacts, edit
contact information, and delete contacts.

The user interface was created using the Swing


library in Java. The interface includes input fields
for the name, phone number, email address, and
notes. Users can also add a profile picture to a
contact, which is stored in a separate folder.
Implementation:-
Requirements:

Java Development Kit (JDK) installed on the


system.

Integrated Development Environment (IDE) like


Eclipse or IntelliJ IDEA.

JavaFX library for creating the user interface.

Implementation:

We will create a JavaFX-based user interface to


interact with the user. The contact information will
be stored in a file on the local file system. The file
will be read and written using Java I/O libraries.

Creating the User Interface:

We will create a JavaFX-based user interface for


the contact number book application. The user
interface will consist of a main window, which will
have buttons for adding, viewing, editing, and
deleting contacts.

Creating the Contact Class:

We will create a Contact class that will hold the


contact information like name, phone number, and
email address. This class will be used to create
new contacts, edit existing ones, and delete
contacts.

Implementing Add Contact Feature:

When the user clicks the "Add Contact" button, a


new window will open where the user can enter
the contact information. Once the user clicks the
"Save" button, the contact information will be
saved to the file.

Implementing View Contact Feature:

When the user clicks the "View Contacts" button, a


new window will open that will display all the
contacts currently stored in the file.

Implementing Edit Contact Feature:

When the user clicks the "Edit Contact" button, a


new window will open where the user can select
the contact to edit. Once the user selects a
contact and clicks the "Edit" button, the contact
information will be loaded into the form for editing.
Once the user clicks the "Save" button, the contact
information will be updated in the file.
Implementing Delete Contact Feature:

When the user clicks the "Delete Contact" button,


a new window will open where the user can select
the contact to delete. Once the user selects a
contact and clicks the "Delete" button, the contact
will be removed from the file.
Input code:-
import java.util.ArrayList;

import java.util.Scanner;

class Address {

private String name;

private String email;

private String phone;

public Address(String name, String email, String phone) {

this.name = name;

this.email = email;

this.phone = phone;

public String getName() {

return name;

public String getEmail() {

return email;

public String getPhone() {

return phone;

public void setEmail(String email) {

this.email = email;

}
public void setPhone(String phone) {

this.phone = phone;

public String toString() {

return "Name: " + name + ", Email: " + email + ", Phone: " + phone;

class AddressBook {

private ArrayList<Address> addressList;

public AddressBook() {

addressList = new ArrayList<Address>();

public void addAddress(Address address) {

addressList.add(address);

public void removeAddress(Address address) {

addressList.remove(address);

public Address findAddress(String name) {

for (Address address : addressList) {

if (address.getName().equals(name)) {

return address;

return null;

}
public void printAddressBook() {

for (Address address : addressList) {

System.out.println(address.toString());

public class Main {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

AddressBook addressBook = new AddressBook();

System.out.println("Welcome to the address book program!");

boolean loop = true;

while (loop) {

System.out.println("\nPlease select an option:");

System.out.println("1. Add an Contact");

System.out.println("2. Remove an Contact");

System.out.println("3. Find an Contact");

System.out.println("4. Print the Contact number book");

System.out.println("5. Quit");

int option = scanner.nextInt();

scanner.nextLine();

switch (option) {

case 1:

System.out.println("Enter the name:");

String name = scanner.nextLine();

System.out.println("Enter the email:");

String email = scanner.nextLine();


System.out.println("Enter the phone:");

String phone = scanner.nextLine();

Address address = new Address(name, email, phone);

addressBook.addAddress(address);

System.out.println("Contact number added successfully!");

break;

case 2:

System.out.println("Enter the name of the Contact to remove:");

String nameToRemove = scanner.nextLine();

Address addressToRemove = addressBook.findAddress(nameToRemove);

if (addressToRemove != null) {

addressBook.removeAddress(addressToRemove);

System.out.println("Contact removed successfully!");

} else {

System.out.println("Contact not found!");

break;

case 3:

System.out.println("Enter the name of the Contact to find:");

String nameToFind = scanner.nextLine();

Address addressToFind = addressBook.findAddress(nameToFind);

if (addressToFind != null) {

System.out.println(addressToFind.toString());

} else {

System.out.println("Contact not found!");

break;

case 4:
System.out.println("Printing Contact book:");

addressBook.printAddressBook();

break;

case 5:

loop = false;

break;

default:

System.out.println("Invalid option!");

break;

System.out.println("Thank You!");

Output:-
Result:-
The Contact Number Book microproject was
successfully implemented, providing a simple and
efficient way to manage contact information.
Users can easily add and edit contact information,
search for specific contacts, and view all saved
contacts. The user interface is intuitive and user-
friendly, making it easy for users to interact with
the application.

Conclusion:-
The Contact Number Book microproject
demonstrates the use of Core Java programming
language in creating a simple contact management
system. It provides an organized and efficient way
of storing and accessing contact information.
Future improvements could include the addition of
more features such as the ability to import and
export contacts, as well as integration with other
applications. Overall, the Contact Number Book
microproject is a useful tool for managing contact
information.

*******************Thank You*********************

You might also like