Computer Science 121
Assignment 5
Due: November 1, 1999

Write a Java application that will read information about 5 cities from the keyboard. The information should include the city's name, it's high temperature, low temperature and normal high temperature. After the data for each city is read in, the program should display the average temperature and whether or not the high temperature is above, equal to, or below the normal high temperature.

Use the declarations for the classes below.

public class CityTemps
{
    public static void main (String [] args)
    {
        City ourCity = new City ();
        ourCity.readAndCompareTemperatures ();
    } // method main
} // class CityTemps

class City
{
    private String cityName;
    private int highTemp, lowTemp, normalHigh, averageTemp;

    public City ()
    {
        cityName = "";
        highTemp = 0;
        lowTemp = 0;
        normalHigh = 0;
        averageHigh = 0;
    } // constructor

    public void readDataFromKeyboard ()
    {
        // Fill in code to read cityName, highTemp and lowTemp from the keyboard.
    } // method readDataFromKeyboard

    public int calculateAverage ()
    {
        // Fill in the code to calculate and return the average temperature.
    } // method calculateAverage

    public void displayAverageTemp ()
    {
        // Fill in the code to display the average temperature.
    } // method displayAverageTemp

    public void readAndCompareTemperatures ()
    {
        // Fill in the code to read the data for five cities from the keyboard. After each city's
        // data has been read, display the average temperature and whether the high temperature
        // is above, equal to or below the normal high temperature.
    } // method readAndCompareTemperatures

} // class City