Discussion Question 1
Review the definition of control structure on p. 45 in Extended Prelude to Programming Concepts and Design (2nd ed.). Then, think about the pseudocode algorithm you would write for a simple task, such as making a peanut butter sandwich, for example, as well as three simple control structures that could be used to create this algorithm. What do you think is the most difficult part of creating the algorithm? What can you do to make this process easier?
According to the text, the definition of control structure is a series of properly organized groups of statements. In simpler meaning, the statements of any pseudocode algorithm utilize control structures within the coding to make the program act a certain way. There are three basic control structures that can be assimilated into any pseudocode algorithm: sequential, loop, and decision.
The hardest part of creating any algorithm is knowing you have asked all of the right questions. Using an example of making a peanut butter sandwich, the following questions might be asked: What are the food materials needed to make this sandwich?
What are the tools I will need to put together this sandwich? You could even go farther by asking questions like:
Are the knife/plate clean enough to use?
The sequential control structure can be found when the user has multiple choices to pick from when choosing their types of ingredients they want such as choice of peanut butters, choice of flavors of jelly, choices of bread, etc.
The loop control structure happens towards the end of the pseudocode algorithm when the program will ask if the user would like to make another sandwich. If the user selects yes, it returns to the very beginning module and statement and repeats the process and each of its steps.
The decision control structures can be found in the area of the pseudocode in which the program will ask if the peanut butter has been spread to preference. It offers the user a condition and a...
Please join StudyMode to read the full document