Fall 2013, Lab 13

**Assignment.** Plot how temperature and wind speed in El Paso
changes with time.

First, define a class *Weather* each element of which has two
fields: temperature *t* in Fahrenheit and wind speed *w* in miles per hour. Your class should contain
a constructor method and get- and set-methods.

Your program should do the following:

- ask the user for the number of days
*d*he/she want to input; based on this number, create a new array of objects of type*Weather*that will store the weather in these*d*days; - for each of the
*d*days, ask the user for temperature and wind speed, and place this information into the corresponding object; - prepare for plotting temperature and wind;
the x-axis of the standard
*JRaster*is 200 pixels wide; thus, the points corresponding to two consecutive days shall be separated by*s*= 200 /*d*pixels:- the first day corresponds to
*x*_{0}= 0, - the second day corresponds to
*x*_{1}=*s*, - the third day corresponds to
*x*_{2}= 2 **s*, - ...
- the
*i*-th day corresponds to*x*_{i − 1}= (*i*− 1) **s*, - the (
*i*+ 1)-st day corresponds to*x*=_{i}*i***s*, - ...

- the first day corresponds to
- the temperature
*t*at day_{i}*i*+ 1 should be plotted as a point with coordinates*x*=_{i}*i***s*and*y*_{i}= 2 **t*;_{i} - the wind speed
*w*at day_{i}*i*+ 1 should be plotted as a point with coordinates*x*=_{i}*i***s*and*y*_{i}= 5 **w*;_{i} - use different colors for temperature and wind;
- throw and catch exceptions when the data does not fit into the standard
*JRaster*frame, i.e.:- when we have more than 200 days, and/or
- when at least one of the corresponding values
*y*are smaller than 0 or greater than or equal to 200;

- connect the points corresponding to consecutive days by a straight line; this means that for values
*x*between*x*and_{i}*x*_{i+1}, you should take*y*=*y*+ (_{i}*x*−*x*) * (_{i}*y*_{i+1}−*y*)/_{i}*s*.

- the
*input*method that reads the data; - the
*plot*method that plots the data; and - the main method that calls both
*input*and*plot*, catches the exceptions thrown by the*plot*method and prints the appropriate error message(s).

**For extra credit.**

- When the data does not fit into the standard
*JRaster*frame, plot all the data that fits before throwing an exception; e.g., if the data covers more than than 200 days, plot only from the data from first 200 days. - For reading data, use GUI (similarly to what you did in Lab 11).

**When it is due.** Lab 13 is due at the beginning of the
last lab, i.e.:

- on Wednesday December 4 for those who attend Monday-Wednesday labs, and
- on Thursday December 5 for those who attend Tuesday-Thursday labs.