a programming language called Scala, which is supported by Java and
allows distributed programming applications to be seamlessly developed in Java/Scala without the
concern of how to implement threads and multithreading. Any threading requirements are automatically
managed by the Scala architecture. In each of the three weeks a practical class will explore example usage
of Scala and three exercises will be set that require you to extend the development of those practical
Exercise 1: A distributed calculation of Pi
Modify the Pi example described in class to:
a) display the message “I received part of the result!”, followed by the total number of results
received to far, each time a worker returns its result to the master.
b) have every Worker display the time it has taken to calculate its portion of the end Pi result.
Exercise 2: Optimising distributed data management
Extend the Remote example to:
a) include a “Track” case in the “active” method of the “Sender” class. This new case would be
responsible with keeping track (count) of how many times the status was printed to screen and it
should be used in the “c @ Continue” case of the same “active” method (within the first “if”
statement of the “c @ Continue” case). The “Done” case of the same “active” method should also
use this new counter when displaying the summary.
b) use an array ('Map') instead of 4 single 'val' items (remotePath, totalMessages, burstSize,
payloadSize) for keeping track of and accessing the Sender settings. (Note: There are several
locations within the code which need altering, search carefully.)
Exercise 3: Extending distributed object functionality
Modify the Supervision example by adding two more cases to the “Child” class' “receive” method. The
two cases should:
a) store the values of two arbitrary strings (“str1”, “str2”) within the “Child” class.
b) calculate and print the Sum of the lengths of the two strings. (Note: Look at how the “state”
variable is used.)
c) make the “child” object crash through an exception triggered by one of the two new methods by
following the pattern present within the “CommenceOperations” case of the “receive” method of
the “Supervisor” class. (Note: Look at Exception handling when the data types of the parameters
and arguments are incompatible.)
18 freelancer đang chào giá trung bình $150 cho công việc này
hello how are you? i have good experience in developing java program. i read your proposal and i can do it. i hope working with you. please contact with me. thank you.