This project is designed to help you practice threads. This homework is
considered a closed homework. Make sure you read the
open/closed policy before continuing working on this project.
This project does not have public, release, or secret tests. You can submit your project as usual.
Description
For this homework you will implement Java code for a system that reads from the command line some messages and prints each message using a separate thread. You will use System.out.println to generate output.
In the code distribution you will find shells for the classes you will need to implement. The following video shows the functionality associated with the system:
The following requirements are associated with this homework:
You can assume that messages provided in the command line will not have blank spaces. For example, if we want to provide the messages "Fear The Turtle", "Testudo Rocks" and "Maryland" they will be specified in the command line as FearTheTurtle TestudoRocks Maryland.
Your program must handle any number of messages specified in the command line.
The UMCPDisplay class represents the system driver. We will run the main method of this class to use the application.
The MessageThread class represents a message printing thread.
You may not add any additional classes.
A message printing thread will sleep for 500 milliseconds after printing a message.
Every time 10 messages has been printed the system will display a dialog box giving providing the user with the choice to stop the program. The program will stop if the user selects "Yes"; otherwise the program will continue (i.e., selecting "No" or "Cancel")
After choosing to stop the program each message printing thread will print the number of messages displayed and will end.
The application must generate the message "Printing has finished" once every message printing thread has finished.
Your code may not have any data races.
Your system should have the highest level of concurrency possible. For example, you cannot serialize the execution of threads.
You may not use System.exit to stop the execution of the application.
You do not need to write student tests for this homework.
Please make sure you read the academic integrity section of the syllabus so
you understand what is permissible in our programming projects. We want to
remind you that we check your project against other students' projects and any
case of academic dishonesty will be referred to the
University's Office of
Judicial Program.