n children walk around a circle with n-1 evenly-spaced chairs. When the music
stops, each one tries to get to the nearest chair. One of them is bound to fail
thus providing a lesson about life. We want to identify the loser.
The children start evenly spaced around the circle, with the first child, A,
located right next to a chair. The child who follows A as they walk around the circle is B,
the one who follows B is C, etc. The children all start walking when the music starts at a speed that will get them all
the way around the circle in 10 seconds. When the music stops, they each try to
get to the nearest chair.
Create a class Musical that contains a method loser that is given n (the number
of children) and time (the number of seconds the music plays). The method
should return the name of the loser as a String containing just one uppercase letter.
It may be helpful to note that the child who is farther from any chair than each other child
is always the loser.
|