package warmdays;
/**
* This program counts the number of warm days in a given set of days
*
* read more
* @author James Cannon
* @version 10 February 2016
*/
public class WarmDays {
/**
* This is the list of temperatures
*/
private static int[] temps = {30, 17, 38, 25, 21, 23, -4, 13, 19, 1, 5, 10};
public static int countWarmDays(int threshold, int[] data) {
int count = 0;
for (int i=0;ithreshold)
{
count = count + 1;
}
}
return count;
}
public static void main(String[] args) {
System.out.println("# of warm days = " + countWarmDays(20, temps));
}
}