1
我不知道爲什麼,編譯器錯誤指向字符串數組。我應該做一個for循環,並手動填寫每個下標與一年的月份名稱?請幫忙!!我不斷收到編譯器錯誤,說Rainfallmain.java:13:錯誤:<identifier>預計。
import java.util.*;
public class Rainfallmain
{
public static void main(String [] args)
{
double months = 12;
double average = Rainfallyr.getAverage();
double Mostrain = Rainfallyr.getHighest();
double Leastrain = Rainfallyr.getLowest();
double total = Rainfallyr.getTotal();
double [] Rainfallyr = new Rainfall[months];
String[] Mon = {"January", "Febuary", "March", "April", "May", "June", "July", "August". "September", "October", "November", "December"};
getRainvalues(Rainfallyr, mon);
System.out.println(" The total rainfall for the year is " + Mostrain);
System.out.println(" The total least aount of rain is " + Leastrain);
System.out.println(" The total rainfall for the year is " + total);
System.out.println(" The average rainfall for the year is " + average);
}
}
public static void getAllvalues(double []rain, String [] mon)
{
Scanner input = new Scanner(System.in);
for(int i = 0; i < r.length; i++)
{
System.out.print(" Enter Rain for each month" +mon[i]+" :");
r[i] = input.nextDouble();
}
}
你在什麼環境下編碼,它沒有指出那個時期? –
你能推薦我一個IDE,這對於一個沒有經驗的程序員來說很難使用嗎? – alxanderapollo