Design a program that generates 100 random numbers Solved

25.00 $

Categories: ,

Description

5/5 - (1 vote)

Design a program that generates 100 random numbers between 1-1000 and writes them, one per line, to an output file. Change the status of the file to an input file and read the numbers into a list. Determine the following:
• The largest number in the list.
• The smallest number in the list.
• The average of the numbers.
• The total of the numbers.
Module main. Calls the functions writeFile, readFile, and statFile. Declare all necessary variables.
Module writeFile. Uses a loop to generate 100 random numbers between 1-1000. Each number should be written to a file called numbers.dat. Display a message indicating all numbers have been generated and written to a file.
Module readFile. Reads all numbers from the file into a list called numbers. numbers should be returned to the main function and assigned to a variable.
Module statFile. Traverses the list to determine and display the largest number, the smallest number, the average of the numbers, and the total of the numbers.

  • FileOp.zip