JMU
logoQuAQI.png
QuAQI


Introduction

Purpose: The main class for (a prototype of) the QuAQI system.

Physical Details
Attributes:
This class must have a private static attribute that is a reference to the AQIDisplay object it is using. (Note: This attribute must NOT be constructed when it is declared.)
The getAQIDisplay() Method:
This class must have a public static method named getAQIDisplay() that returns the AQIDisplay object it is using.
Operational Details
Setup:
During the "setup phase", this class must do the following (though not necessarily in this order):
  1. Use the NAAQS class to get the array of pollutants.
  2. Use the NAAQS class to get the array of descriptions.
  3. Use the NAAQS class to get the array of AQI ranges.
  4. Use the NAAQS class to get the array of Color objects to use on an AQIDisplay.
  5. Construct a Categorizer object for each pollutant. (To do so, it will need to use the NAAQS class to get the value ranges for each pollutant.)
  6. Construct an AQIDisplay object for the "City of Harrisonburg".
  7. Start the AQIDisplay.
Iterations:
After the "setup phase", this class must iteratively prompt the user (on System.out) to enter the following information (in order):
  1. "Data:"
  2. "Continue?"

You may assume that the user will always respond appropriately to any given prompt. The appropriate responses follow.

  • In response to the "Data:" prompt, the user will respond with a space delimited list of the data for CO, NO2, O3, PM 2.5, PM 10, and SO2 (in that order).
  • In response to the "Continue?" prompt the user will enter either "Y" or "N".

This class must read the responses from System.in. After reading the response to the "Data:" prompt, this class must process the pollutant data.

For each pollutant, this class must use the appropriate Categorizer to calculate the AQI for that pollutant. It must also determine which pollutant has the maximum AQI. (Ties must be resolved "in order". That is, in the event of a tie, the first pollutant with the highest AQI must be chosen.) It must then construct or modify an AQIReport object for the pollutant with the maximum AQI and cause that AQIReport to be displayed on the AQIDisplay.

This process of prompting, reading the responses, and processing the pollutant data must continue until the user does not enter "Y" in response to the "Continue?" prompt.

Shutdown:
After the "iteration phase" terminates, this class must call the shutdown() method of the AQIDisplay object.
Example Sessions
An Example with One Data Set:
In this example, the user responds to the "Data:" prompt as follows:
0.200 4.000 0.305 7.000 7.000 4.000

and the AQIDisplay appears as follows:

Test1.png
An Example with Multiple Data Sets:
In this example, the user responds to the "Data:" prompt as follows:
0.200 4.000 0.027 7.000 7.000 4.000

then repsonds to the "Continue?" prompt as follows:

Y

then responds to the "Data:" prompt as follows:

8.400 4.000 0.025 7.000 7.000 4.000

then repsonds to the "Continue?" prompt as follows:

Y

and then responds to the "Data:" prompt as follows:

0.200 4.000 0.025 7.000 7.000 4.000

and the AQIDisplay appears as follows:

Test2.png

Copyright 2013