Computer Science 121

This program has several errors. See if you can find them and get the program to work correctly.

// An application that averages the high and low temperatures for a city.
// CityTemps is the class containing the main method. It uses the
// City class to create a city.

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

} // class CityTemperatures

// The City class maintains weather statistics for a city.
class City
{
    private String cityName;
    private int highTemp, lowTemp, averageTemp;

    // Class constructor.
    City ()
    {
        cityName = "New York City";
        highTemp = 41;
        lowTemp = 28;
    } // constructor

    // A method that finds the average of the high and low temperatures.
    public int findAverage ()
    {
        averageTemp = (highTemp - lowTemp) / 2;
        return averageTemp;
    } // method findAverage

    // A method that displays the average temperature on the screen.
    public void displayTemps ()
    {
        averegeTemp = findAverage ();
        System.out.println ("The average temperature in " + cityName + " was " + averageTemp);
    } // method displayTemps

} // class City