15,957,045 members
1.00/5 (1 vote)
See more: , +
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.
Posted
Updated 8-Nov-20 22:16pm

## Solution 1

Quote:
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.

## Solution 2

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[^]