brentdanley

COS 160 - Program9 EC

Nov 29th, 2017
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.53 KB | None | 0 0
  1.         // Extra credit
  2.         String[] months = {"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};
  3.  
  4.         System.out.println("Average high temperatures by month");
  5.         int startDate = 0;
  6.         for (int month = 1; month <=12; month++) {
  7.  
  8.             System.out.println(months[month - 1] + ": " + arrayAvg(Arrays.copyOfRange(dailyMaxTemps, startDate, startDate + daysPerMonth[month -1])));
  9.             startDate += daysPerMonth[month - 1];
  10.         }
Advertisement
Add Comment
Please, Sign In to add comment