Question: In this homework, you will implement a multithreaded solution to finding the sum of 9,000,000 double values.Begin, by creating a method that creates an array
In this homework, you will implement a multithreaded solution to finding the sum of 9,000,000 double values.Begin, by creating a method that creates an array (not an arrayList) of 9000000 doubles and populates each index with a random number.Create a class to hold the sum of all the numbers in the array. Protect access to that sum by using a ReentrantLock appropriately. Make sure you use good object oriented techniques in creating this class.Then, create a Runnable that can sum an array of any length and add that sum to a shared total. Separate the array into a minimum of 10 pieces and launch a thread to sum each of the pieces. You probably want more threads, but experiment to find number of threads that seems to sum the quickest.When all threads are done summing their pieces, show the combined sum of all 9,000,000 pieces. Then create a JavaFX GUI that shows the percentage of the array summed and the growing sum.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
