Question: Fall 2018 CS2365- Homework7-Multithread Programming You are asked to implement a message queue class using Java. The following figure depicts a message queue connector class,

 Fall 2018 CS2365- Homework7-Multithread Programming You are asked to implement a"message queue" class using Java. The following figure depicts a message queue

Fall 2018 CS2365- Homework7-Multithread Programming You are asked to implement a "message queue" class using Java. The following figure depicts a message queue connector class, followed by the detailed specifications of operations. The message queue connector class has send0 and receive0, and the size of queue is 3. You can declare additional variables in the message queu e class if necessary To test your implementation, your program should create two separate threads, a producer thread and a consumer thread. The producer thread sends a message having a structure, (string, integer) - e.g., "add", 3) or (multiply", 7) to a consumer thread via a message queue. There is a SimpleCalculation class that has two operations, add0 and "multiply0. You should implement the SimpleCalculation class. When the consumer thread receives a message from the q extracts the message and then calls one of operations on the SimpleCalculation class depending on the message. For example, the consumer thread calls the add0 operation if it receives a message like ("add, 3), while it calls the multiply) operation if it receives a message like ("multiply", 3). The add0 operation in the SimpleCalculation adds 10 to the integer in a message from the producer thread and displays the result on the screen. The multiply0 operation multiplies the integer by 10 and displays the result on the screen. ueue, it The producer thread should displays the messages on the screen before it sends the messages to the consumer thread. The messages are ("add", 4), "multiply", 1), ("multiply", 8), "add", 2). ("add", 3), ("add", 99), "multiply", 53) sent to the consumer Please make a zip file containing all source codes (.java files) for this assignment and submit it to blackboard. Fall 2018 CS2365- Homework7-Multithread Programming You are asked to implement a "message queue" class using Java. The following figure depicts a message queue connector class, followed by the detailed specifications of operations. The message queue connector class has send0 and receive0, and the size of queue is 3. You can declare additional variables in the message queu e class if necessary To test your implementation, your program should create two separate threads, a producer thread and a consumer thread. The producer thread sends a message having a structure, (string, integer) - e.g., "add", 3) or (multiply", 7) to a consumer thread via a message queue. There is a SimpleCalculation class that has two operations, add0 and "multiply0. You should implement the SimpleCalculation class. When the consumer thread receives a message from the q extracts the message and then calls one of operations on the SimpleCalculation class depending on the message. For example, the consumer thread calls the add0 operation if it receives a message like ("add, 3), while it calls the multiply) operation if it receives a message like ("multiply", 3). The add0 operation in the SimpleCalculation adds 10 to the integer in a message from the producer thread and displays the result on the screen. The multiply0 operation multiplies the integer by 10 and displays the result on the screen. ueue, it The producer thread should displays the messages on the screen before it sends the messages to the consumer thread. The messages are ("add", 4), "multiply", 1), ("multiply", 8), "add", 2). ("add", 3), ("add", 99), "multiply", 53) sent to the consumer Please make a zip file containing all source codes (.java files) for this assignment and submit it to blackboard

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!