Urgenthomework logo
Live chat


SCALA Homework Help

Hire SCALA Homework Help Professionals to Boost Your Grades

SCALA Homework Help

Scala Programming improves the need for programming which is useful just as general purposed. It generally helps to program-related with static kind. This program generally runs on JVM or in a virtual machine in Java. It implies aggregation happens in the byte code of Java. One progressively significant component that has made Scala programming impeccable is object situated language. It goes under the OOPs language.

Significance of Scala in Scala Homework Help Online

Despite the fact that this has the element to execute in JVM, yet various highlights in this OOPs language is totally not the same as Java as —

  • Operator Overloading
  • Raw Strings
  • Named parameters
  • For expression
  • Optional parameters
  • Syntactic flexibility
  • Functional Tendencies
  • System of Unified type

Professional Scala Homework Help Services at Urgenthomework

If you are looking to have quality Scala homework help to be done on your assignment, work that will promise you a top evaluation, at that point, you will require help from individuals, specialists, and experts in scala homework and assignments, who see all the highlights that Scala programming homework brings to the table. Our scala homework specialists even monitor new highlights that are added to make the programming language increasingly productive. For students who are making some hard memories understanding the ideas of Scala programming, you can get web-based support for every one of your scala homework and assignments after you have gotten the last draft.

Sample of Scala Homework Help - Distributed Systems Using Scala

Exercise 1: Multi-threaded calculation of Pi 

Extend Exercise 1 as follows: 

Every time the Master actor receives a result from one of the Worker actors,
either print the message “Odd Turn!” or “Even Turn!” in an alternating manner.
For example, the first result should trigger the message “Odd Turn!”,
the second should trigger “Even Turn!”, the third “Odd Turn!”, etc. 

Have every Worker actor display its unique worker identifier at the start of
its Pi calculation contribution. E.g.: “Worker  starting work…”.
Exercise 2: Distributed Network Communication 

Extend Exercise 2 as follows: 

Add a new case to the Receiver actor that accepts a string parameter and
prints that message to console/log. This new case should be called within
the Echo case, with the Echo message (“m”) as its argument.Modify the Receiver
actor to keep track of how many messages it receives through the Echo case.
This number should be printed to console/log when the Shutdown command comes in. 

Exercise 3: Process/Actor Management Hierarchy 

Extend Exercise 3 as follows: 

Create a new actor called Abacus with one case that accepts two integer
parameters and prints to console/log their sum. If either parameter value
is 0, trigger an Exception using the “throw” syntax. Assign management
responsibility over the Abacus actor to the Child actor in a similar manner
to how the Supervisor actor is responsible for the child actor.
This should take place within the
“preStart()” method of the Child actor. 

Test the Abacus actor’s case within the “preStart()” method of the Child actor.

Instructions for Scala Homework Help Exercise

  • Pi Calculation:
    • Create a new Scala Project in Scala IDE and give it a sensible name of your choosing (Pi_Calculation?).
    • Expand the Project structure found on the left-hand side of the IDE until you discover the src folder, which should be empty at this stage.
    • Right-click this src folder and create a new File inside it - give it the name scala.
    • Copy-Paste the code found in the scala exercise file from the VLE (download the ZIP, extract, and open the file with a text editor) into the newly created file.
    • Right-click the project name found on the left-hand side of the IDE and select Properties…. A new window should pop up.
    • Navigate to Java Build Path found on the left-hand side of this new window and then select the Libraries tab, now found on the right-hand side.

Note: IF the project was created on another PC, the Akka libraries path will be different. As such, first select all existing Akka libraries (Click the first one, scroll to the bottom and SHIFT+Click the last one that has a red exclamation mark) and hit the Remove button found on the right-hand side in the lower part of the button group.

  • Click on Add External JARs… and navigate to where you have your Akka folder that you previously unzipped - it should contain the akka-* files as well as a few other ones.
  • Left-click on any of the files and select them all by pressing CTRL+A on your keyboard - this will have the effect of selecting every file in that folder. Then click on Open and then OK.

Note: At this stage, all errors found within the code should disappear, perhaps after a few seconds once the IDE has had a chance to interrogate the new JAR files that were just associated with this project.

  • Finally, in order to run the code, right-click on the scala file found on the left-hand side of the IDE, under the src folder, and select Run As -> Scala Application. After a few seconds of compilation time, this should run the code and bring up the IDE Console tab, usually found at the bottom of the IDE, with the output from the program.
  • Use the Flow comment found at the very top of the code to help you understand how the program is running. This illustrates the different functions/methods/classes it goes through as the program is performing its task.

Note: The algorithm this program is employing in order to calculate the value of Pi is the Leibniz formula, which is a sum of fractions - this is implemented within the calculatePiFor method of the Worker class found within the Pi object. The starting point of the program is where the calculate() method is being called with some parameters, at the very top of the Pi object.

 Akka Remoting:

Note: This is a Scala IDE (Eclipse) project that has been exported from my machine. As such, the akka.remoting.zip file found on the VLE does not need to be extracted, Scala IDE can import it straight away.

  • In Scala IDE, click on the File menu and select Import…. A new window should pop up.
  • Expand the General item and select Existing Projects into Workspace and click Next.
  • Tick Select archive file found at the top and click on the Browse… button found to the right of this, on the same line. A new Filesystem Window should pop up. Navigate to where the remoting.zip is located and open it.
  • Make sure that the new akka_remoting project is listed under the Projects section of the previous window and is ticked. Also, make sure that the Copy projects into workspace option found just below that is also ticked. Click Finish.

Note: At this point, the new akka_remoting project should have been successfully imported by Scala IDE and should be listed on the left-hand side.

  • Follow steps to h. from exercise 1) above to link the Akka libraries to this new project.
  • Once you expand the project structure on the left-hand side of Scala IDE, you should find two .scala files - scala and Receiver.scala. These files are independent of each other but communicate over HTTP with one another. As such, they both need to be run in sequence - first right-click the Receiver.scala file and select Run As -> Scala Application, then do the same with Sender.scala. This should, after a few seconds of compilation time, start producing output in the Console window found at the bottom of Scala IDE.

Note: This program illustrates how two Scala Actors can easily communicate between themselves through HTTP messages. The message they send to one another are all defined within the Sender.scala file as case class or case object definitions within the Sender object and used further down in the def active(…) method found in the Sender class. The actor reference found throughout this method is referring to an instance of the Receiver. So, in essence, the Sender is talking to itself - it’s sending commands (the case class or case object part of the code) that it wants to execute over to the Receiver, at which point the Receiver echoes them back to the Sender exactly as they were originally sent, which finally makes the Sender execute them.

Copyright © 2009-2023 UrgentHomework.com, All right reserved.