/****************************************************************************** * Name: Reference Solution * NetID: ref * Precept: P00 * * Description: Plots the annual precipitation since 1900 by reading in data * from a file and creating a line plot. ******************************************************************************/ public class Precipitation { public static void main(String[] args) { int YEAR_START = 1900; int YEAR_END = 2017; int LOW = 15; int HIGH = 75; StdDraw.setXscale(YEAR_START, YEAR_END); StdDraw.setYscale(LOW, HIGH); // assumes one or more input int yearFrom = StdIn.readInt(); double amountFrom = StdIn.readDouble(); // read data from stdin while (!StdIn.isEmpty()) { // get the next year and amount int yearTo = StdIn.readInt(); double amountTo = StdIn.readDouble(); // plot the line StdDraw.line(yearFrom, amountFrom, yearTo, amountTo); // reset the year and amount yearFrom = yearTo; amountFrom = amountTo; } } }