[Solved] Far Need 3 Methods 1 Called Fastestrunner Takes Array Integers Array Strings Prints Names Q37214478
This is what I have so far I need 3 methods
1 called fastestRunner which takes an array of integers and andan array of Strings, and prints out the names and times( inminutes) of the first ,second and third runners in each year. Thismethod also returns the index corresponding to the person with thelowest time(the first runner)
( This method should be called from the main method).
Another called swapFirst that puts the name of the fastestrunner at the beginning of the array.This method takes an array ofStrings and an integer as its input and returns the modifiedarray.
( This method should be called from the fatestRunnermethod.)
And lastly one called compareTimes that compares the time inminutes of both
years and returns an array with the record of the minutesimproved or hindered back. This method takes two arrays and returnsan array.
( This method should be called from the main method.)
Im stuck and need help also please explain if possible
package race.project;
public class RaceProject {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String runnersName [] = {“Emily”, “Simon”, “Paul”, “Aaron”, “Kate”,”Cindy”, “Ryan”, “James”, “Michael”, “Sara”, “Joseph”, “Juan”,”Brad”};
int runnersTime2017 [] = {357, 299, 432, 326, 275, 450, 265, 343,264, 308, 242, 377, 273};
// int runnersTime2018 [] = {341, 307, 328, 283, 274, 359, 256,323, 269, 308, 249, 340, 238};
fastestRunner2017(runnersTime2017, runnersName);
swapFirst(runnersName, runnersTime2017);
//
// compareTimes(runnersTime2017, runnersTime2018);
}
public static int fastestRunner2017(int Array1[], StringNames[]){
int Smallest = Array1[0];
int secondSmallest = Smallest;
int thirdSmallest = secondSmallest;
for(int i=0;i<Array1.length;i++){
if(Array1[i] < Smallest){
thirdSmallest = secondSmallest;
secondSmallest = Smallest;
Smallest = Array1[i];
}
else if(secondSmallest > Array1[i] && Array1[i] >Smallest){
secondSmallest = Array1[i];
}
else if (thirdSmallest > Array1[i] && Array1[i] >secondSmallest){
thirdSmallest = Array1[i];
}
}
System.out.println(thirdSmallest + ” ” + secondSmallest + ” ” +Smallest);
return Smallest;
}
public static int swapFirst (String Names[], int Array1[]){
}
}
Expert Answer
Answer to This is what I have so far I need 3 methods 1 called fastestRunner which takes an array of integers and and an array of … . . .
OR

