INTRODUCTION: Download this document (S11 Flowgorithm Assignment.docx) from Blackboard, save it on your computer (in a folder that you can easily locate), and then open it in Word.
PREREQUISITE: You need to have the Flowgorithm program installed. Refer to S02 Flowgorithm Assignment if you have not done this already.
TASKS: NOTE: Flowgorithm does not have the capability to read from or write to text files. So, for this assignment, you will get a little break. You will go back to Chapter 8, and write a simple sequential search from Program 8-7 on pages 300-301.
The sequential search is far simpler than the binary search, as you will see in the pseudocode. The array does not have to be sorted. The index starts at position 0, and goes straight through the array until either a match is found (at which time the Boolean found variable is set to True), or the end of the array is reached.
As you can imagine, the sequential search is far less efficient than the binary search, and the larger the array, the less efficient it is. A file of 10000 elements would take, on the average, 5000 comparisons in a sequential search to find a matching item, and 10000 comparisons to determine that there was not a matching item. The binary search would return its result in a maximum of 14 comparisons.
TASKS: This assignment is taken from Program 8-7 on pages 300-301 in Chapter 8 of the textbook. In this program, you will:
- Create a Flowgorithm program from pseudocode
- Declare a String array containing names
- Ask the user to input a name
- Use a sequential search to find a match, or determine there is no match, and display the result
ASSIGNMENT: Start Flowgorithm, and then do the assignment outlined in step 1. Save the Flowgorithm file on your flash drive or PC as S11.fprg. Submit the Flowgorithm file in Blackboard.
- Create a Flowgorithm program from the pseudocode in Program 8-7. You have encountered all components of this program in previous assignments. Include the usual comment lines for Author, Date and Description.
- Run the program with the input on page 301. Your output in the Console window should show the same output as on page 301. If there are any errors, recheck the instructions and correct them, then resave the file.
- Submit the Flowgorithm file S11.fprg by clicking on the View/Complete Assignment link in Blackboard, and attaching the file.
DEBUGGING THE PROGRAM: One of the greatest skills a programmer can develop is debugging, which means locating and fixing errors in a program. Email your instructor and ASK QUESTIONS if you are having trouble. Please attach your Flowgorithm file (S11.fprg) to your email.
CHECKLIST FOR SUBMITTING THE ASSIGNMENT:
- You have tested the Flowgorithm program (S11.fprg) and it works correctly
- Then, Attach the Flowgorithm file (S11.fprg) and Submit it through Blackboard
Reviews
There are no reviews yet.