Question: Write a multi-threaded program, Stats.java, in Java that calculates various statistical values for a list of numbers. This program (think of it as the parent

Write a multi-threaded program, Stats.java, in Java that calculates various statistical values for a list of numbers. This program (think of it as the "parent" thread) will prompt the user to provide a single line of input consisting of a series of whitespace-separated numbers and then print the average, maximum, and minimum values entered. For example, suppose your program is passed the integers

90 81 78 95 79 72 85

The program will report (in this order):

The average value is 82
The minimum value is 72
The maximum value is 95

Restrictions:

  • Your program must not make any assumptions as to how many numbers the user will enter
  • Your program MUST use three separate worker threads to calculate the output values: one will determine the average of the numbers, the second will determine the maximum value, and the third will determine the minimum value
  • The values must be output in the specified order every time the program is run
  • The calculations must occur concurrently, as much as possible, to allow the program to complete as quickly as possible

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Below is a Java program called Statsjava that calculates the average maximum and minimum values of a series of numbers using three separate worker thr... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!