Multithreading in Java Solution

Multithreading in Java Solution

Implementation of a set of classes and associated test program for synchronized, runnable objects of a particular type.

You are to create a Java abstract class named displayCount that contains a public method named display() that is implemented to call its protected abstract method called genNext(). This method is to be implemented as a private method in the (concrete) subclasses to generate the next number (as a word) in a particular language. The displayCount class should also implement the Runnable interface. Its run method should be implemented to call the display method each time it is called (as a running thread).
All concrete subclasses must implement the genNext() method to display a next number (up to ten), displayed as a word, each time called, e.g,
one, two, three, four, …., ten
Create a set of three (concrete) subclasses of the displayCount class that each implements the counting of numbers in a different language (e.g., displayCountEnglish, displayCountSpanish, displayMandarin, etc.). Besides English, you may use any other two languages that you want.
Finally, develop a class named bilingualDisplayCount that is designed to display the counting from one to ten in two languages, such that the secondary language is displayed in parentheses as given below,
one (uno), two (dos), three (tres), four (quarto), …., ten (diez)
one (yi), two (er), three (san), four (si), five (wu), six (liu), seven(qi), eight (ba), nine (jiu), ten (shi)
Whether the words are displayed in parentheses or not is determined by the way that the concrete classes are constructed. Develop a test program that displays what is shown above, for all combinations of the three languages (e.g., English/Spanish, Spanish/English, English/Mandarin, Mandarin/English, Mandarin/Spanish, etc.) This is a link to information on Java threads, with examples that are closely related to what needs to be done for this Assignment


The class diagram for this assignment is given below.
DisplayCount {abstract}
+display() synchronized
+create(DisplayCount firstLang,
DisplayCount secondLang)

Powered by