Java的问题,请各位达人帮帮忙!

来源:百度知道 编辑:UC知道 时间:2024/05/13 17:02:25
JAVA的一道作业,是用blueJ编程,要用到数组。。。小弟我那节课没去上。。。请各位帮帮忙!
Declare an array to hold integer data for the rainfall for each of the seven days of the week,and write a method to calculate and display the total rainfall for the week.
第一步的题意翻成中文大概就是:“写一个type是int的array来表示一周的降雨量。”这个我能写出来,是int[] rainfall = new int[7] 第二步是要写一个完整的方法,就是method来统计和表示出来一周的总降雨量。。。

没太看明白你翻译的意思 是这个意思吗??

public class Sort {
public static void main(String[] args) {
int[] rainfall = new int[7];
rainfall[0] = 10;
rainfall[1] = 0;
rainfall[2] = 100;
rainfall[3] = 50;
rainfall[4] = 50;
rainfall[5] = 0;
rainfall[6] = 10;
int count = new Sort().count(rainfall); //一周总数
System.out.println(count);
}
public int count(int[] a){
int count = 0;
for (int i = 0; i < a.length; i++) {
count +=a[i];
}
return count;
}

迷糊 英语不灵 看不明白题意!!!

题目不清楚。第二个没法写。