Renee P.

asked • 08/18/21

Help me please I can’t figure this out

Creates a functioninputNumbersthat uses a loop to allow the user to input 5 numbers between 1 and 10 and store them in an array called numArray. All input should be validated as a number between 1-10 inclusive. Call the function from def main().

2. Creates a function addNumsthat accepts numArrayand uses a loop to add the numbers in the array. Call the function from def main(). Return the total to def main()and assign the total to a variable total. Display total.

3. Creates a function writeArraythat writes contents of the array to a file called dat, one number per line. A new file should be created if a file calledExam2.datcurrently exists. Call the function from def main()

4. Creates a function readArraythat reads contents of the file and displays them. 

5. Displays how many of the numbers read are greater than 5 and how many of the numbers are 5 or less.

6. Implements the following pseudocode for the main module exactly as shown

Main module

//Call functions to input numbers.

Set numArray = inputNumbers()

//Call function to add numbers

Set total = addNums(numArray)

Display “The total of the numbers is”, total

// Write array contents to a file.

Call writeArray(numArray)

//Read and display numbers in the file

Call readArray()

End Module


1 Expert Answer

By:

Patrick B. answered • 08/18/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.