// Computer Science 121
/* An application that averages the high and low temperatures for a city.  This is the corrected version. */

// CityTemps is the class containing the main method.  It uses the City class to create a city.
public class CityTemps
{
     public static void main (String [] args)
     {
          City ourCity = new City ();
          ourCity.displayTemps ();
     } // method main
} // class CityTemps

// 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";
          highTemp = 69;
          lowTemp = 55;
     } // 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 ()
     {
          averageTemp = findAverage ();
          System.out.println ("The average temperature in " + cityName + " was " + averageTemp);
     } // method displayTemps
} // class City