✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Your task is to add the missing code in an EllipticalMachine class and its corresponding JUnit test class EllipticalMachineTest , based on the PEKKO IoT tutorial example we saw in class.
You will implement the following messages in the EllipticalMachine class.
Type of activity | MET |
Resistance level 2, light effort | 4.6 |
Resistance level 5, moderate effort | 4.9 |
Resistance level 8. vigorous effort | 5.7 |
For example, Calories burned per minute = (4.6 * 100 * 3.5) ÷ 200
=8.049999999999999 (using Java Double precision).
Your test scenario:
Expected result:
[2025-11-14 14:07:17,409] [INFO] [org.apache.pekko.event.slf4j.Slf4jLogger] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [] - Slf4jLogger started[2025-11-14 14:07:17,464] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-5] [pekko://EllipticalMachineTest/user/$a] - Eliptical Machine actor group-device started[2025-11-14 14:07:17,471] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-5] [pekko://EllipticalMachineTest/user/$a] - Calories burned per minute unknown. Weight was not set.[2025-11-14 14:07:17,477] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [pekko://EllipticalMachineTest/user/$b] - Eliptical Machine actor group-device started[2025-11-14 14:07:17,478] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [pekko://EllipticalMachineTest/user/$b] - Recorded weight in Kg 100.0 with 1[2025-11-14 14:07:17,479] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [pekko://EllipticalMachineTest/user/$b] - Recorded resistance level2 with 1[2025-11-14 14:07:17,479] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-5] [pekko://EllipticalMachineTest/user/$b] - Calories burned per minute = 8.049999999999999 [2025-11-14 14:07:17,480] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [pekko://EllipticalMachineTest/user/$b] - Recorded weight in Kg 100.0 with 3[2025-11-14 14:07:17,480] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [pekko://EllipticalMachineTest/user/$b] - Recorded resistance level5 with 3[2025-11-14 14:07:17,480] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-5] [pekko://EllipticalMachineTest/user/$b] - Calories burned per minute = 8.575000000000001 [2025-11-14 14:07:17,508] [INFO] [org.apache.pekko.actor.CoordinatedShutdown] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [CoordinatedShutdown(pekko://EllipticalMachineTest)] - Running CoordinatedShutdown with reason [ActorSystemTerminateReason][2025-11-14 14:07:17,526] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-6] [pekko://EllipticalMachineTest/user/$a] - Eliptical Machine actor group-device stopped[2025-11-14 14:07:17,526] [INFO] [com.example.EllipticalMachine] [EllipticalMachineTest-pekko.actor.default-dispatcher-3] [pekko://EllipticalMachineTest/user/$b] - Eliptical Machine actor group-device stopped
Process finished with exit code 0
Important:
You must work on the code provided in the link https://drive.google.com/file/d/1k0JhIkf4FY7-EznbSss0sJZXCcWgBanw/view?usp=drive_link
Do not change anything in the provided files. Add your solution below the //TODO: comments inside EllipticalMachine and EllipticalMachineTest.
Only submit EllipticalMachine.java and EllipticalMachineTest.java
You must include your full name in each class as a comment.
Your score for this question will be based on
The correctness of your test class (2 points)
The correct use of PEKKO (4 points)
The correct computation of the calories burned (3 points)
Total 9 points.
Remember that you can compile and run the test using the command “sbt test” in the command line inside the project root folder.