Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Plz use JAVA to write this code???AND follow all provided rules Enter 1 to add c

ID: 3699762 • Letter: P

Question

Plz use JAVA to write this code???AND follow all provided rules

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 1

Enter last name: Adams

Enter first name: John

Enter Street name: Vernon

Enter phone number: 555-1234

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 1

Enter last name: Smith

Enter first name: Amy

Enter Street name: Robie

Enter phone number: 555-4567

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 1

Enter last name: Brown

Enter first name: Adam

Enter Street name: Robie

Enter phone number: 555-9812

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 2

Name                   Street                   Number

Adams, John         Vernon                          555-1234

Brown, Adam Robie                   555-9812

Smith, Amy          Robie                   555-4567

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 3

Enter 1 to search name, 2 to search address, 3 to search phone number: 3

Enter what to search: 555-9812

Name                   Street                   Number

Brown, Adam Robie                   555-9812

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 3

Enter 1 to search name, 2 to search address, 3 to search phone number: 2

Enter what to search: Robie

Name                   Street                   Number

Brown, Adam Robie                   555-9812

Smith, Amy          Robie                   555-4567

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 4

Enter 1 to search name, 2 to search address, 3 to search phone number, 4 to display all contacts: 2

Enter what to search: Robie

Name                   Street                   Number

1. Brown, Adam             Robie                   555-9812

2. Smith, Amy                Robie                   555-4567

Entry to delete: 2

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 2

Name                   Street                   Number

Adam, John          Vernon 555-1234

Brown, Adam Robie                   555-9812

Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 5

Good-bye!

In this assignment, you will design a class called Addessek that uses a Linked List to store nodes that are made up of Contacts. You must adapt the Node class that we wrote in class, and adapt and add to the Linked List class that we developed together (You cannot use java.utilLinkedlist for this assignment).+ 1. Start by designing the Contact class that holds a person's last name, first name, street name, and phone number: public class Contact private String lastName private String firstName private String streetName: private String phone; //complete the rest of the class by adding appropriate constructors, get, set methods, toString, etc.+ le 2. Re-design the Node class to hold Contact as its data. 3. Re-design the Linked List class that we developed in class so that the methods will work with Nodes with Contacts as its data. Finally, you will create the AddcessBook class. It has a LinkedList and methods to add a contact, display all contacts, search for a specific contact and display it, or search and delete a specific contact.+ When a contact is added, it should be added in order alphabetically to the list by last name (and then by first name if there are multiple contacts with the same last name). To add alphabetically look at the compareTo String method which compares Strings lexicographically (returns an int>0,

Explanation / Answer

Description: There is 5 class as following

1.Node :it help linked list to add contact

2. LinkedList: it has implemented actual functinality of adding , removing , deleting , searching with the help of NODE class

3.Contact: class with all property

4.AddressBook: actual class which getcalled from main class and use LinkedList and Node to manipulate data

5.CheggAddressBookLinkedListDemo: entry point of project , we calling the addressbook from here


package cheggaddressbooklinkedlistdemo;


public class Node<T> {
private T data;
private Node next;
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public Node getNext() {
return next;
}
public void setNext(Node next) {
this.next = next;
}
public Node(T data) {
this.data = data;
this.next = null;
}
}


package cheggaddressbooklinkedlistdemo;


public class LinkedList<T>
{
private Node<T> head; // first node in the linked list
private int count;

public int getCount() {
return count;
}

public Node getHead() {
return head;
}

public LinkedList() {
head = null; // creates an empty linked list
count = 0;
}

public void displayList(){
Node<T> current = head; // start at beginning
while(current != null) // until end of list,
{
System.out.print(current.getData() + " ");
current = current.getNext();
//move to next link
}
System.out.println("");
}

public Node deleteFront()
{
Node<T> temp = head;
if(head.getNext() == null) // if only one item
return null; // return null
head = head.getNext(); // first --> old next
count--;
return temp;
}

public void removeValue(T value)
{
Node<T> current = head, prev = null;
while (current != null)
{ //if current node contains value
if (value == current.getData())
{
//handle front removal (case 1)
if( prev == null)
head = current.getNext();
else //handle mid removal (case 2)
prev.setNext(current.getNext());
// prev node now points to maxNode's (a.k.a current) successor, removing max node.

break; // remove first occurence only
}
// update prev to next position (curr)
prev = current;
// move curr to the next node
current = current.getNext();
}
}

public void addFront(T n)
{
Node<T> newNode = new Node<T>(n);
newNode.setNext(head);
head = newNode;
count++;
}
public void Search(String SearchWord, int Category) {

  

}
}


package cheggaddressbooklinkedlistdemo;


public class Contact {
  
private String lastName ;
private String firtName ;
private String streetName ;
private String phone ;
  
public Contact()
{
lastName="";
firtName="";
streetName="";
phone="";
}
public String getLastName() {
return lastName;
}
public void setLastName(String NewlastName) {
  
  
lastName=NewlastName;
}
  
public String getFirtName() {
return firtName;
}
public void setFirtName(String NewfirtName) {
  
  
firtName=NewfirtName;
}
public String getStreetName() {
return streetName;
}
public void setStreetName(String _streetName) {
  
  
streetName=_streetName;
}
public String getPhone() {
return phone;
}
public void setPhone(String _phone) {
  
  
phone=_phone;
}
}

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package cheggaddressbooklinkedlistdemo;
import java.util.*;
/**
*
* @author dell
*/
public class AddressBook {

private LinkedList<Contact> list;

public AddressBook() {

list = new LinkedList<Contact>();
}

public void addConatct(Contact ct) {

list.addFront(ct);
}

public void removeContact(Contact ct) {
list.removeValue(ct);
}

public LinkedList getList() {

return list;
}

public void Search(String SearchWord, int Category) {

LinkedList<Contact> allList = getList();

for (int i = 0; i < allList.getCount(); i++) {
// Contact tempObjContact = (Contact) allList.getHead(i);
//System.out.println(tempObjContact.getFirstName());
}

}

public void dispplayAllContact() {
list.displayList();
}
}

package cheggaddressbooklinkedlistdemo;

import java.util.Scanner;

public class CheggAddressBookLinkedListDemo {

public static void main(String[] args) {

CheggAddressBookLinkedListDemo objMain = new CheggAddressBookLinkedListDemo();
AddressBook obj = new AddressBook();

System.out.println("Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: 1");

Scanner scanner = new Scanner(System.in);
String input = scanner.nextLine();

if ("5".equals(input)) {
System.out.println("Exit!");

}
if ("1".equals(input)) {

Contact cntAdd = objMain.GetContactObject();
obj.addConatct(cntAdd);

}
if ("2".equals(input)) {

obj.dispplayAllContact();

}
if ("3".equals(input)) {
System.out.print("Enter 1 to search name, 2 to search address, 3 to search phone number: 3 : ");
Integer category = scanner.nextInt();
System.out.println(" ");
System.out.print("Enter what to search: ");
String SearchedWord = scanner.nextLine();
System.out.println(" ");
obj.Search(SearchedWord, category);

}
if ("4".equals(input)) {

System.out.print("Enter 1 to add contact, 2 to display, 3 to search, 4 to delete, 5 to quit: ");
String Option = scanner.nextLine();
System.out.println(" ");
if ("4".equals(Option)) {
System.out.print("Enter 1 to search name, 2 to search address, 3 to search phone number, 4 to display all contacts: ");
String Category = scanner.nextLine();

System.out.println(" ");
System.out.print("Enter what to search: ");
String SearchedWord = scanner.nextLine();
}

//obj.removeContact();
}

}

public Contact GetContactObject() {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter last name: ");
String lastname = scanner.nextLine();
System.out.println(" ");

System.out.print("Enter first name: ");
String firstname = scanner.nextLine();
System.out.println(" ");

System.out.print("Enter Street name: ");
String StreetName = scanner.nextLine();
System.out.println(" ");

System.out.print("Enter phone number:: ");
String phonenumber = scanner.nextLine();
System.out.println(" ");

Contact cntAdd = new Contact();
cntAdd.setLastName(lastname);
cntAdd.setFirtName(firstname);
cntAdd.setStreetName(StreetName);
cntAdd.setPhone(phonenumber);

return cntAdd;
}

}

Please add and build and run the project one by one

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote