正在加载图片...
Array processing-2 double[ rainfall new double [12]i String[] monthName new String [12] onthName [0] JAnuary i monthName[1]=February The same pattern for the remaining ten months double annualAverage, sum =0.0 for (int rainfall length i++)t rainfall[i] inputBox getDouble(" Rainfall for month monthName [i] sum + rainfall[ili The actual month annualAverage sum rainfall length name instead of a numbe C 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 9-7© 2000 McGraw-Hill Introduction to Object-Oriented Programming with Java--Wu Chapter 9 - 7 Array Processing – 2 double[] rainfall = new double[12]; String[] monthName = new String[12]; monthName[0] = “January”; monthName[1] = “February”; … double annualAverage, sum = 0.0; for (int i = 0; i < rainfall.length; i++) { rainfall[i] = inputBox.getDouble("Rainfall for month " + monthName[i] ); sum += rainfall[i]; } annualAverage = sum / rainfall.length; The same pattern for the remaining ten months. The actual month name instead of a number
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有