Im building a program and it has to take a set of information (Runners and their times) and make a method that will compare the times of all runners. Im a beginner and don't know much and have to stick to what I know. I need to get the lowest runners in the 2017 year please lead me in the right direction. (I want to learn but not get the answer!!!) Thanks!
Ive tried to compare all the integers of the array but that seemed long and also wrong
public static void main(String[] args) {
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);
}
public static int fastestRunner2017(int Array1 []){ //This is what I am trying to do
if (Array1[1] <= Array1[]){
System.out.println(T1);
return T1;
}
//This is what I did before and seemed wrong
else if (T2 <= T1 && T2 <= T3 && T2 <= T4 && T2 <= T5 && T2 <= T6 && T2 <= T7 && T2 <= T8 && T2 <= T9 && T2 <= T10 && T2 <= T11 && T2 <= T12 && T2 <= T13){
System.out.println(T2);
return T2;
}
else if (T3 <= T1 && T3 <= T2 && T3 <= T4 && T3 <= T5 && T3 <= T6 && T3 <= T7 && T3 <= T8 && T3 <= T9 && T3 <= T10 && T3 <= T11 && T3 <= T12 && T3 <= T13){
System.out.println(T3);
return T3;
}
else if (T4 <= T1 && T4 <= T2 && T4 <= T3 && T4 <= T5){
System.out.println(T4);
return T4;
}
else {
System.out.println(T13);
return T13;
}
I want to compare one part of the array to the rest of them