Flowchart (EXAM #2) Flashcards
When do we use flowcharting?
Any process we want to understand better:
- Software development
- Business process modeling
- Decision process modeling
Symbols: oval
The Start and End symbol begins and ends the process
Symbols: parallelogram
The Input/Output (a.k.a. “data”) symbol is used to represent inputs from the user or outputs to the user
Symbols: rectangle
The Process symbol is used to represent any type of function or action. This symbol may be used to represent one step or a sequence of steps.
Symbols: arrow
The Flow symbol represents movement to the next operation
Symbols: diamond
The Decision symbol is a junction where a decision must be made. A decision must return true or false
Symbols: circle
The Connector symbol is used when more than one flow arrow head needs to come together.
Flowchart
efficient way to express algorithms in a succinct and precise manner
- valuable when conceptualizing a process, analyzing requirements, and training workers and users
- used by both technical and nontechnical people (commonly used by managers, engineers, and software developers)
variable name conventions
use short variable name, should not be separated by spaces cause computer programs think of variables as a single entity & will interpret a space as the end of the variable name
variable legends
include legend to show short variables & their associated meaning so the reader can understand what the short name means
Flow Control Patterns
- sequence
- selection
- repetition
Sequence Pattern
one step is completed followed by a next step & so on
Selection Pattern
the answer to a question causes a branch in the process, thus some steps are skipped under certain circumstances. As we define a decisions, it will return either true or false.
-have selection decision structures:
+if then else
+if then null else
+nested selection
Repetition (looping, iteration)
allows 1+ actions to be repeated until a condition is met, a step or set of steps is repeated until a certain condition is met
Why Gotos are prohibited?
In the early days of programming, programmers often used a programming flow control feature called a goto that would allow a program to jump from one location to another location. For example, a program may jump from near the beginning to near the end and then to the middle. Programs jumped all over the place. This practice made it difficult to maintain and update programs because it was almost impossible to follow the logic of a program from start to finish in a linear fashion.
selection decision structures:
+if then else
+if then null else
+nested selection
if-then-else
-does one thing if the decision returns true and does a different thing if the decision returns false
(4 parts: diamond (logical test), true branch (do-if-true), false branch(do if false), and end (represented by the connection circle.)
if-then-null-else
- an ELSE action is not required for every If-Then statement. If the ELSE condition is omitted, the If-Then-Null-Else is used instead
- if the logical test is true, then the do-if-true action should be taken otherwise no action is taken
- Ex: if a sales person exceeds sales goals, calculate a bonus if not then do not calculate
Nested IF-Then-Else
-depending on how the first decision is answered, the flow can go to additional decisions
(if decision 1 is true, then path 1 is executed and the selection process finishes, otherwise decision 2 is test and if it returns true then path 2 is executed and the selection finishes. If decision 2 is false, decision 3 is tested and etc.)(IF all previous decisions are false, then Case Else path is executed)
Repetition (Loop) Structures
-a step or set of steps is repeated until a certain condition is met, the repeating code is referred to as a loop or iteration
EX: while loop
while loop
-tests a condition first, if the test returns false, then a process is executed, then the flow loops back to the decision again, each time the test returns false then a process is executed.
if the test returns true, the algorithm exits the loop (can be thought of as a repeating if-then-else statement)
Input
- inputs can come from two sources: from users or the data stored in a setup section. Values stored in a setup storage can reduce the need to re-input values each time the program is run.
- When regular inputs(input obtained from the user each time the algorithm is executed. Includes beginning of algorithm inputs and process control inputs) are required, the word INPUT should be used )
- when input from setup is required, use INPUT-FROM-SETUP (input from data stored for frequent use. These vales are not changed each time the program is run)
Outputs
Three types of outputs exist for flowcharts:
-Display (used when output is sent to the computer screen, the unchanged inputs in an output symbol are surrounded by parentheses to differentiate them from the other outputs)
-Print (used when output is sent to a printer)
Prompt (used when it is necessary to ask the user for some specific input after the program has begun, the prose of the prompt should be in quotation marks. followed by an input, and then a decision structure)
Flowcharting process
- start
- input data
- perform the algorithm (logic and calculations)
- output the results
- end
order of operations
- everything with parentheses
- inner parentheses take precedence over outer parentheses
- The power (^) operator takes precedence over multiply (*) & divide (/).
- Multiply (*) & divide (/) take precedence over addition (+) and subtraction (-)