In this workbook, we're going to present the data to the user.
First, we're in to remove this line of code.
And after the user enters their information, the main thread must wait for the worker threads to die
thread.
Two, three, four and five.
Sir, right here, we have to say.
Threat to join.
Threat three, don't join.
Redford, join.
And Thread five join.
And seems like ran out to try to run the code.
Catch the interrupted exception if it happens to occur.
By the way, this is never going to get called because we're never actually interrupting any of the
threads, but we need to catch it anyway.
It's a tracked exception.
And.
I'm going to copy this code over from learning the parts.
At this point in the main thread, we know that every worker thread has finished its tasks because we
were waiting for them to die, which means we're safe to run the following code and just fill in the
placeholders where needed.
And it looks like here what we're going to have to do is take a very similar approach to what we did
in the lesson where we created some class level variables accretive static double variable called furniture.
Set it equal to zero at first.
Well, call one technology.
Well, call one supplies.
And will call one of them just average.
And after each task finishes executing, we will set the class level variable equal to the results furniture
technology.
Supplies.
And average.
Here we can print the result after every worker thread is finished executing its task.
He will say supplies and average.
If we run our code now.
As the user is interacting with the application, these threads are all running in the background.
And beautiful.