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

So the same question has been popping up, but there seems to be a misunderstandi

ID: 3838703 • Letter: S

Question

So the same question has been popping up, but there seems to be a misunderstanding of the programming language. This needs to be in a 'generic' language, found in "Programming Logic and Design" by Tony Gaddis. If you look up the text book answers you will see an example of what the pseudocode looks like.

This is the actual assignment: Project Program: 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.

This is the backbone of the assignment:

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)

o 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

o When each item on the menu is done, redisplay the menu

Output: (per each navigation menu item)

Design a GUI screen that include

o Keypad with numbers o 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

o Fields (phone number, first name, last name)

o Set & get method

o Constructor

. o Methods (add, update, delete, save, sort, display the list etc. )

Object: personal contact list Or company phone directory (inheritance)

o 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

Thank you for your help!

Explanation / Answer

As mentioned it is just pseudo code for contact class. I have written all information as mentioned. Please go through below code

import sys
class Contact(object):
def __init__(self):
number = 0;
fname = ""
lname = ""
book = []
def set(self, num, firstname, lastname):
"""
SET:
Setting values of number fname and lname
"""
number = num
fname = firstname
lname = lastname
dict_obj = {'number':number, 'fname':fname,'lname':lname}
return dict_obj
def get(self):
"""
GET:
Current values of number fnama and lname
"""
return self.number, self.fname, self.lname

def add(self, num, firstname, lastname):
"""
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
"""
number = int(raw_input("Enter Phone Number: "))
if len(number) == 10:
self.number = number
else:
print("Please retry")
sys.exit(1)
name = raw_input("Enter first and last name: ")
if name is None:
self.fname = "first"
self.lname = "last"
else:
self.fname = name.split(' ')[0]
self.lname = name.split(' ')[1]
self.book.append(self.set(self.number, self.fname, self.lname))
def update(self, num):
"""
UPDATE or 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
"""
flag = 0
for contact in self.book:
if num == contact['number']:
flag = 1
print contact['number']
print contact['fname']
print contact['lname']
name = raw_input("Update first and last name: ")
if name is None:
contact['fname'] = "first"
contact['lname'] = "last"
else:
contact['fname'] = name.split(' ')[0]
contact['lname'] = name.split(' ')[1]
if flag == 0:
print "Not Found"
  
def delete(self, value):
"""
DEL:
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
"""
flag = 0
confirm == 0
del_contact ={}
for contact in self.book:
if num == contact['number']:
if int(raw_input("Delete Sure : ")) == 1:
flag = 1
confirm = 1
del_contact = contact
if flag == 1 and confirm == 1 :
self.book.remove(del_contact)
else:
print "Not Action/Found"
def enquire(self, num):
"""
INQ:
Enter phone number
If found – display name
If not found – display message
If found and name is blank – display message
"""
for contact in self.book:
if num == contact['number']:
print contact['number']
print contact['fname']
print contact['lname']
def save(self):
"""
SAVE:
data to file
"""
f = open('contact.txt','w')
f.write(self.book)
f.close()
  
def sort(self, order):
"""
SORT:
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
"""
if order == 'asc':
self.book.sort()
if order == 'desc':
self.book.sort(reverse=True)
for contact in self.book:
print contact['number']
print contact['fname']
print contact['lname']
def display(self):
"""
Display:
Info to user
"""
for contact in self.book:
print contact['number']
print contact['fname']
print contact['lname']
  


"""
personal contact list Or company phone directory (inheritance)
"""
class PersonalContact(Contact):
pass

class CompanyContact(Contact):
pass

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