Click here to Skip to main content
14,883,472 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
In a 4 × 100 meters relay event, each team consists of four runners. Each runner in a team completes 100 meters. A relay baton(a stick) is carried by each runner, after completing 100 meters, it is passed to the team member continuing the next leg. Assuming that each runner runs at a constant speed (the average speed of the runner), and all the first leg runners (of each team) start at the same time. Create a thread class 'RelayRunner' that simulates the behaviour of a runner. A runner must announce his/her name, the starting time of his leg, and the time at which he/she is handing over the relay baton to the next leg runner. Write a class 'RelayTeam' (which includes 4 runners) to model the behaviour of a team participating in the 4 × 100 meters relay event. Create three teams participating in the 4 × 100 meters relay and conduct the race. Print the winning team name once the race is complete.

What I have tried:

Not tried that good but have a little idea on how to do it. Currently in a rush to get the solution.
Updated 8-Nov-20 22:16pm

Currently in a rush to get the solution.
Slow down and think about what you need to do. Rushing into code before you have planned the logic is likely to lead to a greater number of mistakes.
We are more than willing to help those that are stuck: but that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900