From the course: Advanced Java: Threads and Concurrency
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Challenge: Number magic and voting simulator - Java Tutorial
From the course: Advanced Java: Threads and Concurrency
Challenge: Number magic and voting simulator
(quirky music) - [Narrator] Now it's time for another challenge. In this challenge, you get to practice what you learned about executors, mainly, ExecutorService and ScheduledExecutorService. Here, I want you to work on two coding tasks. Task 01 involves performing three tasks on a given number. Calculate the square root, calculate the factorial, and represent the number in binary form and executing them using an executor service. The number is obtained from user input and the code for it is already written for you. Task 02 involves creating a voting simulator where two tasks should be performed, voting and counting. I've given you the required code to work on these two tasks. In the code, you can find two classes named NumberMagic and VotingSimulator. You should write your code in these two classes. Apart from that, there's a candidate class with name and list of votes as attributes that represents a candidate for whom voting is done. For Task 01, write your code in the NumberMagic…
Contents
-
-
-
-
-
(Locked)
Managing thread execution: Thread pools and executors4m 3s
-
(Locked)
ExecutorService3m 55s
-
(Locked)
Implementing an executor: ExecutorService in action5m 48s
-
(Locked)
Executing tasks periodically with ScheduledExecutorService6m 22s
-
(Locked)
Challenge: Number magic and voting simulator2m 20s
-
(Locked)
Solution: Number magic and voting simulator5m 41s
-
(Locked)
-
-
-
-
-