Question: Write a java code to do the following: 1. Ask the user to enter three integer numbers: x, y , and z 2. create three

Write a java code to do the following:

1. Ask the user to enter three integer numbers: x, y , and z

2. create three threads (Th1, Th2, and Th3)

3. the three threads will print all the numbers starting from x with addition of y and up to z. the name of the thread will be printed beside each number.

4. the last two numbers in the series will be printed by (Th1)

Example: in case: x=20, y=10, z=73 then the output will be some thing like this:

20 (Th2)

30 (Th1)

40 (Th2)

50 (Th3)

60 (Th1)

70 (Th1)

Finished

Another example: in case: x=4, y=5, z=42 then the output will be some thing like this:

4 (Th3)

9 (Th1)

14 (Th2)

19 (Th1)

24 (Th2)

29 (Th3)

34 (Th1)

39 (Th1)

Finished

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!