Starting from:

$25

CSI365-Program 1 Program Python and Java that Fill Array/list with Random Integer Between 0-1 Solved

Familiarity with the current programming languages

Write a same program in both Python and Java that fill an array/list with random integer values between 0 and 100 inclusive (think test scores, no bonus points), displays the high score, the low score, and the average (with 2 places after the decimal point). The array/list should store exactly 20 integers.

 

The two languages tend to use different terminology for similar language components. For this program description I will refer to an array (Java) or a list (Ptython) as an array. I will refer to a method (Java) or a function (Python) as a function, just for simplicity.

 

The main program must be implemented as follows:

Create array

Call function to accept the array and fill it with random values Call function to accept the array and return the high value Print the returned value

Call function to accept the array and return low value Print the returned value

Call function to accept the array and return the average Print returned value

Call function to print out a counting value (1-20) and all twenty values to the display

 

Note that ALL MOST ALL OF THE WORK IS TO BE DONE IN FUNCTIONS. Create the array in the “main” part of the program. Then call the various functions. The functions that return a value should not generate output. The final function will generate output and not return anything. 

 

To generate pseudo-random numbers look for the following commands as a starting point:

Python – random.randint()

Java – Random().nextInt()

 

You don’t have to use these commands; they are just suggestions.

 

A sample of the output might be (with made-up data):

High value 93

Low value  17

Average 53.24

 

Values

26
93
65 …
20 43

 

At some point after the assignments have been graded there will be questions asked in class discussing differences in how the various commands are implemented in the two languages. 

More products