The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
October 2001



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


pls help ASAP

Posted by donna on October 24, 2001 at 12:42 AM

please sombodey help me on below assignment.

In this assignment, you are to modify an existing class and create several other unrelated classes. You are to add features involving equality to each class. In addition, for each class that you create, you must provide a constructor whose parameters should be all the instance variables of the class, in the same order we use to describe the instance variables in the questions. We shall be autotesting your programs and our autotesting program will expect exactly the information we require, no more and no less. Do not print anything in any of your classes as this will cause the autotester to reject your results. In addition, be certain that the constructors have the correct parameters in the correct order as failure to do so will also cause unhappiness for the autotester and hence for you.

Write a class WeatherSensor that has two instance variables, one of type Thermometer (for temperature in degrees Celsius: an int) and the other of type Barometer (for air pressure in kiloPascals: a double). Write all three classes, with constructors and equals methods for all three. Two Thermometers are considered equal if the temperatures are equal. Two Barometers are considered equal if the air pressures are within 0.1 kPa of each other.

Here's the tricky bit: WeatherSensors may be incomplete, missing either the Thermometer or Barometer, or both. Two WeatherSensors are equal if their Thermometers are equal (or both are missing) and their Barometers are equal (or both are missing)


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us