我的代码片段:
...
System.out.println("\t" + "MONTH |" + "\t" + "HIGH | " + "\t" + "LOW |" + "\t" + "AVERAGE |" + "\t" + "RANGE");
System.out.println("\t" + "______________________________________________");
main.averageMonthOne(hightemp, lowtemp);
in1.close();
out.close();
}//end of main
private static double averageMonthOne (int hightemp, int lowtemp)
{
double avgM = (hightemp + lowtemp)/2;
System.out.println(avgM);
return avgM;
}
我希望能够使用我收到的平均值averageMonthOne
并将其分别放在 println 中的“AVERAGE”一词下。那可能吗?
预期输出:
MONTH | HIGH | LOW | AVERAGE | RANGE
_____________________________________
30.0