Write a multithreaded program that calculates various statistical values for a list of numbers. This program...

80.2K

Verified Solution

Question

Programming

Write a multithreaded program that calculates variousstatistical values for a list of numbers. This program will bepassed a series of numbers on the command line and will then createthree separate worker threads. One thread will determine theaverage of the numbers, the second
will determine the maximum value, and the third will determine theminimum value. For example, suppose your program is passed theintegers

90 81 78 95 79 72 85 The program will report

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

The variables representing the average, minimum, and maximumvalues will be stored globally. The worker threads will set thesevalues, and the parent thread will output the values once theworkers have exited. (We could obviously expand this program bycreating additional threads

that determine other statistical values, such as median andstandard deviation.) (You can use Java or C)

Answer & Explanation Solved by verified expert
4.3 Ratings (634 Votes)
For this program we will be coding in Java as java threadingAPI is more easy to use than PThread API in CProgram will ask user for number of elements input each elementand displays required statistics For taking inputsjavautilScanner is used as it is very convinentto useFor creating threads there are two methods in JavaInheriting Thread classImplementing Runnable interfaceSecond method is used here we create    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students