Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please also provide flowchart with proper symbols. And explain why symbol was used as that is what confuses me the most. Reference Program 6-6 on
Please also provide flowchart with proper symbols. And explain why symbol was used as that is what confuses me the most.
Reference Program 6-6 on pages 293-294. Build a flowchart from the pseudocode. Each line of pseudocode should translate to one flowchart symbol. Submit a PDF of the flowchart for this assignment. To create the PDF, from within Draw.io select File, from the menu select "Export as", then select PDF. The last line of the definition, after the body, reads End Function. This line marks the end of the function definition. Here is an example of a function written in pseudocode: Function Integer sum (Integer num1, Integer num2) Declare Integer result Set result = num 1+ num2 Return result End Function Figure 6-7 illustrates the various parts of the function header. Notice that the function returns an Integer, the function's name is sum, and the function has two Integer parameters, named num1 and num2. Figure 6-7 Parts of the function header The purpose of this function is to accept two integer values as arguments and return their sum. Let's look at the body of the function to see how it works. The first statement, a variable declaration, declares a local Integer variable named result. The next statement assigns the value of num 1+num2 to the result variable. Next, the Return statement executes, which causes the function to end execution and sends the value in the resuit variable back to the part of the program that called the function. Program 6-6 shows a complete pseudocode program that uses the function. Program 6-6 19 I/ The sum function accepts two Integer arguments and 1/ returns the sum of those arguments as an Integer. Function Integer sum(Integer numi, Integer num2) Deciare integer result set result = num 1+ num 2 Return result End Function Program Output (with Input Shown in Bold) Enter your age. 22 [Enter] Enter your best friend's age. 24 [Enter]Together you are 46 years old. In the main module, the program gets two integer values from the user and stores them in the f and secondAge variables. The statement in line 13 calls the sum function, passing firstAge a secondAge as arguments. The value that is returned from the sum function is assigned to the to variable. In this case, the function will return 46 . Figure 6-8 shows how the arguments are passed in function, and how a value is returned back from the functionStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started