/****************************************************************************
* Name: Donna Gabai
* NetID: dgabai
* Precept: P99
* Spring14 Exam 1
*
* Description: Inputs snowfall and temperature for a series of days.
* Outputs number of days, total inches of snow and coldest temp.
* Dependencies: StdIn, StdOut
* ***************************************************************************/
public class SnowStats {
public static void main(String[] args) {
// start at day zero, no snow, hottest possible temperature
int days = 0;
double snowSum = 0.0;
int lowestTemp = Integer.MAX_VALUE;
// read data from standard input and count days
// add snowfall for total, keep lowest temp
while (!StdIn.isEmpty()) {
days++;
snowSum = snowSum + StdIn.readDouble();
int temp = StdIn.readInt();
if (temp < lowestTemp) lowestTemp = temp;
}
StdOut.println("Number of days: " + days);
StdOut.println("Total snow: " + snowSum);
StdOut.println("Coldest Temperature: " + lowestTemp);
}
}