Suppose you are a student of East West University. You have to design a multithreaded system in java for your CSE110 course. So, you are assigned a job with following descriptions. You have to design a class NumberComputator which has a function printComposite(int n) that can take a parameter N and print the composite number from 1 to nth term. Composite numbers are the number that are not prime number. Again, create two thread class (ThreadOne, ThreadTwo) by extending the Thread class so that all of the thread should call the method “printComposite(int n)” of the NumberComputator class. Again, write a main java class named “MultiProgrammingDemo” with a main method that instantiate two objects of two threads(ThreadOne, ThreadTwo). Your task is to process and run two threads simultaneously in the main method by considering the fact that when one thread printing with the printComposite(n) function the other threads must be wait for the completion of the work the initial thread. Design a JAVA application that can perform the task as given in the above scenario.
1. Suppose you are a student of East West University. You have to design a multithreaded
system in java for your CSE110 course. So, you are assigned a job with following
descriptions. You have to design a class NumberComputator which has a function
printComposite(int n) that can take a parameter N and print the composite number
from 1 to nth term. Composite numbers are the number that are not prime number.
Again, create two thread class (ThreadOne, ThreadTwo) by extending the Thread
class so that all of the thread should call the method “printComposite(int n)” of the
NumberComputator class. Again, write a main java class named
“MultiProgrammingDemo” with a main method that instantiate two objects of two
threads(ThreadOne, ThreadTwo).
Your task is to process and run two threads simultaneously in the main method by
considering the fact that when one thread printing with the printComposite(n)
function the other threads must be wait for the completion of the work the initial thread.
Design a JAVA application that can perform the task as given in the above scenario.
Step by step
Solved in 2 steps with 1 images