So here is the question: Design a program that asks the user to enter a series o
ID: 3820402 • Letter: S
Question
So here is the question:
Design a program that asks the user to enter a series 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
However I need to make psuedocode as follows:
The main module should have: a. Create a Constant to represent the number of Elements (seats) in the ARRAY
, b. Declare one variable to represent the Array of type Integer
c. Declare five other variables of type Integer
d.Create a SET line
e. Create a SET line
f. The main module also needs two loops:
i. The first loop should be a for loop that Displays a question asking the user to type in a number and also has an INPUT statement that reads each one in the ARRAY
j. The second loop should also be a for loop that must have a formula to total all the numbers inside the Array.
k. Add an if statement inside the body of the second loop.
l. Also, add another if statement inside the body of the second loop similar to line# # 21,22 and 23 of page 308 g. Finally, it should have a formula to calculate the average: Use SET to create an average formula
m. Finally, the last line of the first module it should Call the second module
2. The second module should only have four DISPLAY lines showing the Total, average, lowest and highest numbers.
There is a lot to do in here so thanks a ton if you can find an answer to it!
Also this can be written in psuedocde or python
Explanation / Answer
Here is the pseudocode
const size=20
int arr[size]
int sum, low, high
sum =0
// Read Numbers
for i = 1 to size
read arr[i]
end
for i=1 to size
// Find highest and lowest element
if i==1
low = arr[1]
high= arr[1]
else
if low > arr[i]
low = arr[i]
end
if high < arr[i]
high = arr[i]
end
// find sum
sum = sum + arr[i]
end
// Displaying results
avg = sum/size
print hihest, lowest, sum , avg
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.