write pseudocode to design a phone contact list program. Your program includes a
ID: 3837895 • Letter: W
Question
write pseudocode to design a phone contact list program. Your program includes a Graphical User Interface that allows user to add new contacts, update existing contacts, search specific contact from the contact list, sort the contact list in ascending or descending order, delete an old contact. Your program should also provide help screen, an exit button to close the program and displays error messages for any exceptions. The answer should be in pseudocode and not C++ or java.
Input:
Write a data text file with a list of phone number (10 digits with dashes, 555-555-5555)
Read text file to retrieve contact info (phone number, first name, last name)
Read the file into memory (hint: parallel arrays)
Individual contact info can also be entered from the keypad
Process: (open/read the file, display the menu, close file)
Maintain the phone list by ADD, UPDATE, DELETE, INQUIRE/SEARCH, SORTING
When each item on the menu is done, redisplay the menu
Output: (per each navigation menu item)
Design a GUI screen that include
Keypad with numbers
Navigation menu
Add New Contact ( textbox for first name, last name, textbox for phone number)
Update Contact (search by phone number to display name and phone OR search by name to display name and phone number)
Delete Contact from List (change name to blank)
Inquire: enter phone name or name
List: Sort list either ascending or descending order by first name or last name
Help
Save phone list
Exit
Define a CONTACT class
Fields (phone number, first name, last name)
Set & get method
Constructor
Methods (add, update, delete, save, sort, display the list etc. )
Object: personal contact list Or company phone directory (inheritance)
Public class PersonalContact extends Contact { }
Add:
Enter phone number (phone number: range 1-999)
If not found – display message
If name is blank, enter name (first and last)
If name NOT blank, save contact info, display confirm message
Change:
Enter phone number
If not found – display message
IF found – display name and ask for new name
If name is blank, ask for new name
Delete:
Enter phone number
If not found – display message
If found – display name and confirm delete
If confirm is yes – blank out name
If confirm is no – return to menu
If name is blank, display message
Inquire:
Enter phone number
If found – display name
If not found – display message
If found and name is blank – display message
Sort:
Question: sort ascending, descending or return to menu
If return to menu, then return to menu
If ascending- sort phone number ascending
If descending - sort phone number in descending order
After sort, display phone list
Help:
Display menu option and a one description of the function
Save:
Write phone list back to file
Exit:
If file is open, save phone list, close file
Terminate program
Error:
If a menu selection is made that is not displayed (1-9)
Issue message and display the help screen
Explanation / Answer
Design the menu driven:
//The following code resides in the main function. cout << "Add New Contact press $ to cancel" << endl; printline('-', 20); counter = 0; //Loop until correct name and mobile number are entered do { flag = 0; if(counter) cout << "Try again press $ to cancel" << endl; //counts how many times the do-while loop executes counter++; cout << "Name: "; cin >> temp_name; //Cancel operation if(temp_name=="$") { cancel_flag = 1; break; } cout << "Mobile No.: "; cin >> temp_mob; //Cancel operation if(temp_mob=="$") { cancel_flag = 1; break; } //Check whether name exists for(i=0; i<100; i++) if(person[i].name_exists(temp_name)) { cout << "The name you entered is already there" "in the phonebook, enter a different name." << endl; flag = 1; break; } }while(!name_valid(temp_name) || flag || !mob_valid(temp_mob)); if(cancel_flag) { system("cls"); break; } //This code adds the contact to phonebook for(i=0; i<100; i++) if(person[i].add(temp_name, temp_mob)) { cout << "Contact added successfully!" << endl; flag = 1; break; } if(!flag) cout << "Memory full! Delete some contacts first." << endl; //The following code resides in the class bool add(string new_name, string new_mob) { if(name=="") { name = new_name; mob = new_mob; return 1; // Success } else return 0; // Failure }
Editing contact:
Removing contact:
Searching for a contact:
Printline function:
Validation :
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.