Computers and Personal Digital Assistant (PDA) devices help to organize many asp
ID: 3866611 • Letter: C
Question
Computers and Personal Digital Assistant (PDA) devices help to organize many aspects of a user's life. A common application of these devices is a contact list where items such as name and phone number can be stored. You will create a similar application. The company you work for is a very small business and their record keeping is quite outdated. All of the contacts that the company uses are kept on paper. As a newly hired JAVA developer your first task is to create a company contact list application to help control contact information. Solution: Create a Design Document showing a mockup of what the new application will look like and include any details about how it will function. Assume you will present this document to the management of your company. Create a JAVA application to create and maintain a contact list. The contact list should include the contact name, address, city, state, zip and phone number. In addition, the contact list application must have the ability to Add, Delete, Update and Find contacts as needed. The contact list application will display appropriate messages when a user successfully adds, updates or deletes a contact and will also display any error messages when a given user action fails. You must create a database of your choice to store the contact information. Submit all files and code* created in a compressed zip folder to your instructor using the Learn process.Explanation / Answer
import java.util.*
class Contact_List
{
String names[]=new String[5];
String adresses[]=new String[5];
String cities[]=new String[5];
String States[]=new String[5];
Long zip_code[]=new Long[5];
Long Mobile[]=new Long[5];
int i=0,length=0;;
public void set(String name,String address,String city,String
state,long zip,long phone)
{
names[i]=name;
adresses[i]=address;
cities[i]=city;
States[i]=state;
zip_code[i]=zip;
Mobile[i]=phone;
i++;
length++;
}
public int find(Long phone)
{
for(int j=0;j<length;j++)
{
if(phone==Mobile[j])
{
return j;
}
}
return -1;
}
public void read(int size)
{
long zip,phone;
String name,output,address,city;
Scanner sc = new Scanner(System.in);
for(int i=0;i<size;i++)
{
System.out.println("Enter The contact Name:");
name=sc.next();
System.out.println("Enter The Address:");
address=sc.next();
System.out.println("Enter The Name of the City");
city=sc.next();
System.out.println("Enter The Name of the State");
state=sc.next();
System.out.println("Enter The ZipCode");
zip=sc.nextLong();
System.out.println("Enter The Phone");
phone=sc.nextLong();
set(name,address,city,state,zip,phone);
}
}
public static void main(String args[])
{
int size,opt,result;
long zip,phone;
String name,output,address,city;
Scanner sc = new Scanner(System.in);
Contact_List obj=new Contact_List();
System.out.println("------------------------------------");
System.out.println("Enter how many No of Contact Information
want to record:");
size=sc.nextInt();
obj.read(size);
while(true)
{
System.out.println("------------------------------------");
System.out.println("************Menu*********************");
System.out.println("1.-Add New Contact Information");
System.out.println("2.-Delete The Contact Information");
System.out.println("3.-Update The Contact Details");
System.out.println("4.-Find/Search The Contact Details");
System.out.println("5.-Exit from the menu");
System.out.println("Select Any Operation:");
opt=sc.nextInt();
switch(opt)
{
case 1:
obj.read(1);
break;
case 2:
System.out.println("Enter The Contact Mobile no to delete:");
phone=sc.nextLong();
result=obj.find(phone);
if(result!=-1)
System.out.println("The Contact No Details are Deleted Sucessfully:");
else
System.out.println("The Contact Details are Not Found:");
break;
case 3:
System.out.println("Enter The Phone Number to Modify/Update:");
phone=sc.nextLong();
result=obj.find(phone);
if(result!=-1)
{
System.out.println("Enter Which Field You want to Update:");
phone=sc.nextLong();
System.out.println("Update:");
System.out.println("1.-Contact Name:");
System.out.println("2.-Address:");
System.out.println("3.-City:");
System.out.println("4.-State:");
System.out.println("5.-ZipCode");
System.out.println("6.Mobile Number:");
int choice=sc.next();
switch(choice)
{
case 1:
System.out.println("Enter New Contact Name:");
name=sc.next();
names[result]=name;
break;
case 2:
System.out.println("Enter New Address:");
address=sc.next();
adresses[result=address;
break;
case 3:
System.out.println("Enter New City Name:");
city=sc.next();
cities[result]=city;
break;
case 4:
System.out.println("Enter New state Name:");
state=sc.next();
States[result]=state;
break;
case 5:
System.out.println("Enter New Zipcode:");
zip=sc.nextLong();
zip_code[result]=zip;
break;
case 6:
System.out.println("Enter New Mobile:");
phone=sc.nextLong();
Mobile[result]=phone;
break;
default:
System.out.println("Wrong Details: please check");
}
}
else
System.out.println("The Contact Details are Not Found:");
break;
case 4:
System.out.println("Enter The Contact Mobile to Search:");
phone=sc.nextLong();
result=obj.find(phone);
if(result!=-1)
{
System.out.println("The Contact Details are ");
System.out.println("contact
Name:"+" "+"Address"+" "+"City"+" "+"State"+" "+"ZipCode"+"+ "+"Phone");
System.out.println(names[result]+" "+adresses[result]+" "+cities[result]+" "+States[result]+" "+zip_code[result]+" "+Mobile[result]);
else
System.out.println("The Contact Details are Not Found:");
break;
case 5:
exit(0);
default:
System.out.println("Wrong Option:");
}
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.