advertisement

TBE 540 Pseudocode to Flowchart Exercise Use the pseudocode to make a flowchart for the following program descriptions. Use these flowcharting symbols: START/END PROCESS INPUT/OUTPUT DECISION Program 1 The program will (1) ask for the user’s name, then (2) print HI and the name. The program will then (3) ask what year the user was born, (4) calculate the age, and (5) print the age. (6) If the student is over 21, the program will (7) print YOU ARE AN ADULT! PSEUDOCODE START FLOWCHART START (1) Get name Get name (2) Print HI and name (3) Ask year born (4) Calculate age (5) Print age (6) Age > 21? (7) If Y, print message END Program 2 The program will (1) choose two random numbers, then (2) print them out as an addition problem. The program will then (3) ask the user to (4) enter the correct answer. (5) If the answer is correct, the program will (6) print RIGHT. (6) If the answer is wrong, the program will (7) print NO, THE ANSWER IS and the correct answer. PSEUDOCODE START FLOWCHART START (1) Calc. two random numbers (2) Print addition problem (3) Print message (ENTER ANSWER) (4) Wait for input (5) Answer correct? (6) If Y, print RIGHT (7) If N, print NO THE ANSWER IS + correct answer. END Calc. 2 random num. Program 3 The goal of the program is to take in several numbers and print the average. Each number will come in one at a time. Each time a number comes in, the computer will have to add it to the running total and add one to the “number of numbers” so the average can be calculated. This process will need to be repeated until the user is finished entering all the numbers. At the end, the average must be calculated and printed. There will have to be a way for the computer to tell whether or not there is another number coming in or whether it should print the average. NOTE: You can show “looping” (repeating) on a flowchart or the pseudocode by just drawing a line with an arrow. Brainstorm on the steps needed to make this happen. Write the “pseudocode” and (if you dare) try the flowchart. PSEUDOCODE START FLOWCHART START