I have a requirement where i need to write Psuedocode. If the description is not clear, please ask me questions. I need to present my OOPS concepts here.
Assume we are writing a simple car race program.
We have 10 Cars in the race and we want to know what order the cars
are in. So we will periodically call UpdateLeaderBoard.
Assume that we have a record or a structure, Car, in pseudo-code:
You can make it into an object if you want.
Assume for now that the track is straight. We don't have to take
laps into account. We are only concerned with distance from some
0 point. To make it interesting, not all the cars start at the same point.
Position, here, refers to location on the track, not ranking on the LeaderBoard.
Assume that we can initialize the cars by reading data in from a file.
> proc InitCars
> I = 0;
> while I < 10 do
You can rework that however you want, but you can delegate the details
of reading the file if you want.
The routine that calculates the leaders will be called several times
throughout the race to find the current ranking.
Show me, in pseudo-code or language of your choice, what that
overall program would look like. Im especially interested in the
details of UpdateLeaderBoard and where it is called.