I have the following code that holds an array with 7 values, each for each day of the week. then I have to create a function that sums these 7 values (successfully completed), says what is the largest value of this Array (successfully completed) and then indicate what day that value occurred (is where the prolema is ). I continue to have a problem in int day = rainHours.indexOf (maxTempDay); where it says "can not find symbol - method indexOf (int)." I leave here the code thanks for help.
public static void main(String[] args)
{
int [] rainHours=new int[]{1,3,0,0,6,3,8};
int sum = rainInBusyDays(rainHours);
System.out.println(sum);
int maxValue=maxRain(rainHours);
int maxTempDay=mostRainy(rainHours);
int day=rainHours.indexOf(maxTempDay);
System . out . println("O valor máximo é:" + maxValue + " no " + day + "º dia da semana ");
}
public static int rainInBusyDays(int[] rainH)
{
int total = 0;
for (int i =1; i<rainH.length-1 ;i++)
{
total =total + rainH[i];
}
return total;
}
public static int maxRain(int[] rainHo)
{
int max = 0;
for(int j=0;j<rainHo.length;j++)
{
if (rainHo[j] > max)
{
max= rainHo[j];
}
}
return max;
}
public static int mostRainy(int[] rainHou)
{
int maxTempDay = 0;
for(int k = 0 ; k<rainHou.length;k++)
{
if(rainHou[k] > maxTempDay)
{
maxTempDay = rainHou[k];
}
}
return maxTempDay;
}