In: Computer Science
DESIGN A FLOWCHART IN THE APPLICATION FLOWGORITHM
Number Analysis Program Design a program that asks the user to enter a maximum of 20 numbers. The program should store the numbers in an array and then display the following data: -The lowest number in the array. -The highest number in the array. -The total of the numbers in the array. -The average of the numbers in the array.
PLEASE AND THANK YOU
Here is the completed solution for this problem. The program will let the user enter a maximum of 20 integers, or until he/she enter a sentinel value of -999 to end early.
I have attached both the code (which you can save to a file with extension: .fprg (for example: program.fprg) and open in Flowgorithm), and the screenshot of the flowchart. Comments are included, go through it, learn how things work and let me know if you have any doubts or if you need anything to change. If you are satisfied with the solution, please rate the answer. If not, PLEASE let me know before you rate, I’ll help you fix whatever issues. Thanks\
CODE:
<?xml version="1.0"?>
<flowgorithm fileversion="2.11">
<attributes>
<attribute name="name" value=""/>
<attribute name="authors" value=" "/>
<attribute name="about" value=""/>
<attribute name="saved" value="2020-10-14 06:08:39 PM"/>
<attribute name="created" value="RW5pZ21hO1RJVEFOSVVNOzIwMjAtMTAtMTQ7MDU6Mzc6MjkgUE07MjQ5Mg=="/>
<attribute name="edited" value="RW5pZ21hO1RJVEFOSVVNOzIwMjAtMTAtMTQ7MDY6MDg6MzkgUE07MTsyNjAw"/>
</attributes>
<function name="Main" type="None" variable="">
<parameters/>
<body>
<comment text="declaring variables"/>
<declare name="numbers" type="Integer" array="True" size="20"/>
<declare name="size, lowest, highest, total, value" type="Integer" array="False" size=""/>
<declare name="average" type="Real" array="False" size=""/>
<assign variable="size" expression="0"/>
<comment text="looping"/>
<do expression="size<20 && value!=-999">
<output expression=""Enter an integer (or -999 to quit): "" newline="True"/>
<input variable="value"/>
<comment text="adding value to array if value != -999"/>
<if expression="value!=-999">
<then>
<assign variable="numbers[size]" expression="value"/>
<comment text="if this is first value, setting it as total, lowest and highest"/>
<if expression="size==0">
<then>
<assign variable="total" expression="numbers[size]"/>
<assign variable="lowest" expression="numbers[size]"/>
<assign variable="highest" expression="numbers[size]"/>
</then>
<else>
<comment text="otherwise adding to total, updating lowest or highest if necessary"/>
<assign variable="total" expression="total+numbers[size]"/>
<if expression="numbers[size]<lowest">
<then>
<assign variable="lowest" expression="numbers[size]"/>
</then>
<else/>
</if>
<if expression="numbers[size]>highest">
<then>
<assign variable="highest" expression="numbers[size]"/>
</then>
<else/>
</if>
</else>
</if>
<comment text="updating size"/>
<assign variable="size" expression="size+1"/>
</then>
<else/>
</if>
<comment text="the loop will exit when the user enter -999 or when the user enter a maximum of 20 numbers"/>
</do>
<comment text="if size is 0 (no values entered), displaying error"/>
<if expression="size==0">
<then>
<output expression=""No values entered"" newline="True"/>
</then>
<else>
<comment text="otherwise finding average, displaying stats"/>
<assign variable="average" expression="total/size"/>
<output expression=""The lowest number: "&lowest" newline="True"/>
<output expression=""The highest number: "&highest" newline="True"/>
<output expression=""The sum total: "&total" newline="True"/>
<output expression=""The average: "&average" newline="True"/>
</else>
</if>
</body>
</function>
</flowgorithm>
SCREENSHOT: