The Eversoft Eraser Company has a list of its customers\' names (not necessarily
ID: 3543190 • Letter: T
Question
The Eversoft Eraser Company has a list of its customers' names (not necessarily in alphabetical order) and telephone numbers in a file named "customer" with records of the following form:
last name, first name, phone number
a. Allow the user to input a last name; then search the file and display all names and phone numbers corresponding to that last name.
b. Load the file into parallel arrays and display the list of customers' names and phone numbers in alphabetical order.
I cannot stress it enought that I need this written in pseudo code. Thanks
Explanation / Answer
a)
Accept input (last name) from user
Do Until no more names in list = true
..... if user_last_name equals last_name_in_list then
.......... display names, phone number
.... end if
loop
(Since the names aren't necessarily in alphabetical order, each name in the entire list must be compared.)
b) This pseudocode will vary, depending upon the specific language you're using. For PowerBASIC, it's a simple as:
Dim Customer_LastName(1 to 1000)
Dim Customer_Dummy_Array(1 to 1000)
Dim Customer_FirstName(1 to 1000)
Dim Customer_Number(1 to 1000)
Do Until no more names in list = true
.... INCR x
.....Customer_LastName(x) = last_name_in_list
.....Dummy_Array(x) = last_name_in_list
.....Customer_FirstName(x) = first_name_in_list
.....Customer_Number(x) = number_in_list
LOOP
Array Sort Customer_LastName(), tagarray Customer_FirstName()
Array Sort Dummy_Array(), tagarray Customer_Number()
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.