1
00:00:00,420 --> 00:00:02,790
In this workbook, we're going to present the data to the user.

2
00:00:03,060 --> 00:00:05,640
First, we're in to remove this line of code.

3
00:00:07,730 --> 00:00:13,790
And after the user enters their information, the main thread must wait for the worker threads to die

4
00:00:14,360 --> 00:00:14,600
thread.

5
00:00:14,630 --> 00:00:15,950
Two, three, four and five.

6
00:00:16,400 --> 00:00:17,810
Sir, right here, we have to say.

7
00:00:19,050 --> 00:00:20,760
Threat to join.

8
00:00:23,110 --> 00:00:24,580
Threat three, don't join.

9
00:00:26,910 --> 00:00:28,350
Redford, join.

10
00:00:30,240 --> 00:00:32,009
And Thread five join.

11
00:00:34,370 --> 00:00:38,150
And seems like ran out to try to run the code.

12
00:00:43,390 --> 00:00:46,840
Catch the interrupted exception if it happens to occur.

13
00:00:47,320 --> 00:00:52,120
By the way, this is never going to get called because we're never actually interrupting any of the

14
00:00:52,120 --> 00:00:54,670
threads, but we need to catch it anyway.

15
00:00:54,790 --> 00:00:55,960
It's a tracked exception.

16
00:00:57,260 --> 00:00:57,890
And.

17
00:00:59,790 --> 00:01:02,430
I'm going to copy this code over from learning the parts.

18
00:01:05,450 --> 00:01:10,790
At this point in the main thread, we know that every worker thread has finished its tasks because we

19
00:01:10,790 --> 00:01:16,730
were waiting for them to die, which means we're safe to run the following code and just fill in the

20
00:01:16,730 --> 00:01:18,110
placeholders where needed.

21
00:01:21,590 --> 00:01:25,610
And it looks like here what we're going to have to do is take a very similar approach to what we did

22
00:01:25,610 --> 00:01:34,100
in the lesson where we created some class level variables accretive static double variable called furniture.

23
00:01:37,250 --> 00:01:39,080
Set it equal to zero at first.

24
00:01:41,240 --> 00:01:43,190
Well, call one technology.

25
00:01:44,400 --> 00:01:46,350
Well, call one supplies.

26
00:01:47,690 --> 00:01:51,140
And will call one of them just average.

27
00:01:53,200 --> 00:02:01,030
And after each task finishes executing, we will set the class level variable equal to the results furniture

28
00:02:01,420 --> 00:02:02,320
technology.

29
00:02:04,290 --> 00:02:05,400
Supplies.

30
00:02:06,830 --> 00:02:07,910
And average.

31
00:02:14,380 --> 00:02:19,180
Here we can print the result after every worker thread is finished executing its task.

32
00:02:23,620 --> 00:02:27,280
He will say supplies and average.

33
00:02:29,890 --> 00:02:31,510
If we run our code now.

34
00:02:36,820 --> 00:02:41,710
As the user is interacting with the application, these threads are all running in the background.

35
00:02:44,800 --> 00:02:45,760
And beautiful.

