logo

Crowdly

Browser

Додати до Chrome

SOEN 6441 W 2252 (Fall 2025)

Шукаєте відповіді та рішення тестів для SOEN 6441 W 2252 (Fall 2025)? Перегляньте нашу велику колекцію перевірених відповідей для SOEN 6441 W 2252 (Fall 2025) в moodle.concordia.ca.

Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!

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.

  • RecordWeightInKgAndResistanceLevel. Record the weight of the user, and the resistance level chosen, i.e., 100 kg, level 2.
  • CalculateCaloriesBurned.   Calculate calories burned per minute using the following formula: Calories burned per minute = (MET * body weight in Kg * 3.5) ÷ 200.  Where “MET'' is a measurement of the energy cost of physical activity for a period of time. You can find an activity’s MET on the table below.

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:

  • Record the following weight and temperature: 100 Kg., resistance level 2 and calculating the calories burned.  Add the missing code in EllipticalMachineTest class, specifically inside the method called "testReplyWithCaloriesBurnedPerMinute"

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.

 

Переглянути це питання

Which of the following philosophies is embraced by the Play Framework?

Переглянути це питання

Which of the following is a fault tolerance strategy implemented in PEKKO?

Переглянути це питання

What happens to an actor’s reference when an actor is restarted as a result of a crash?

Переглянути це питання

According to the fundamental tenets of the Actor Model, which list represents the three core actions an actor can perform when processing a message?

Переглянути це питання

In PEKKO, which design pattern do we use to create Actors?

Переглянути це питання

Which of the following best describes the fundamental mechanism of a back-pressure system in a reactive or streaming context?

Переглянути це питання

You have a web app containing sections populated by several backend services, and one of them is not available or not responsive. By applying this pattern you can render differently or hide such a problematic section, without affecting the other sections in your web app.

Переглянути це питання

Which of the following statements is false with respect to PEKKO messages (a.k.a protocols)?

Переглянути це питання

In PEKKO, messages are:

Переглянути це питання

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.concordia.ca?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome