Question
The code in the following sections assumes that the entries in the racer array are added in the order that the racers finished. Show how
The code in the following sections assumes that the entries in the racer array are added in the order that the racers finished. Show how to modify the addRacer method to ensure that this is true. You should assume that the RacerInfo class includes a method named getTimeInSeconds that converts the String used to represent the finishing time when a RacerInfo object is created into an int that expresses the finishing time in seconds. As we did in the version of addRacer shown in Figure 14.20, your version should not bother to display an error message if an attempt is made to add a racer out of order. Instead, your method should simply return without actually adding information about the new racer.
The code in the following sections assumes that the entries in the racer array are added in the order that the racers finished. Show how to modify the addRacer method to ensure that this is true. You should assume that the RacerInfo class includes a method named getTimeInSeconds that converts the String used to represent the finishing time when a RacerInfo object is created into an int that expresses the finishing time in seconds. As we did in the version of addRacer shown in Figure 14.20, your version should not bother to display an error message if an attempt is made to add a racer out of order. Instead, your method should simply return without actually adding information about the new racer.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started