SDEV 140 / Introduction to Software Development
S10 Flowgorithm Assignment / Chapter 9: Sorting and Searching Arrays
(From Program 9-8, pages 369-371)
In this program, you will set up a sorted String array of last names, and a parallel String array of corresponding phone numbers. You will enter a last name to look for, and the program will tell you the person’s phone number if a match was found, or an error message if a match was not found.In this program,
Create a Flowgorithm program as follows.
Include the usual comment lines for Author, Date and Description.
Declare the constant SIZE as an Integer variable, and assign the value 6.
Declare the two String arrays to a size of SIZE, and use individual assignment statements to set their values (names = “Hall”, etc.). This takes some time to type, but you’ll be pleased when you get it working!
Remember that you have to declare and assign variables in separate steps.
You will write a function called binarySearch() with three arguments just as specified in line 31. It will return an Integer value named position, which is declared in line 62 and initially set to -1.
Flowgorithm accepts both the C and Visual Basic operators, so you can specify “not found” as NOT found, or you can specify it as !found
Be careful with your spelling and punctuation. Each non-comment line in this Flowgorithm program can be entered from the pseudocode in the book.
If there are any errors, recheck the instructions and correct them, then resave the file.