Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

List Random Numbers Write a program that will insert random integers between 1 and 150 into a list and perform some calculations. You will prompt

List Random Numbers Write a program that will insert random integers between 1 and 150 into a list and perform some calculations. You will prompt the user to ask them the number of elements in your list. You will then get that many random numbers between 1 and 150 and put them in the list.

You will use a function to sort the numbers in your list. Now, use an iterator to the screen to print the elements in your list.

Lets work with the list to perform some calculations.

Use iterators, algorithms, and list functions (not the user's input variable) to find the sum (iterate through to sum up the elements), mean (average is sum divided by size of list), median (middle value - find the size and use the iterator to move up half way by iterating the iterator half the size times), and range (use algorithms to find the highest and lowest and then take the difference between highest and lowest). Then print the labeled values (with the mean to three decimal places).

Output: List of sorted List numbers on separate lines. The sum, average to three decimal places, median, and range of the numbers in your list.

Document your program with at least 4 lines of comments at the top and at least 5 comments throughout the code for all of the not easily understandable lines of code. Run your program twice using the following number of elements. Submit your main program and submit the output text file of results.

1st run: 5 numbers

2nd run: 25 numbers

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions