Class reservoir which implements interface waterresource


Question1. Write down the class 'Weather' to contain the following:-

i) Data members: humidity, air_pressure, atmospheric_temperature and wind_speed all of datatype double

ii) A no-argument constructor to initialize the humidity to zero

iii) An overloaded constructor with one parameter to assign a value to the air_pressure

iv) An overloaded constructor with two parameters to assign values to the humidity and air_pressure

v) An overloaded constructor with three parameters to assign values to the humidity, air_pressure, atmospheric_temperature

vi) An overloaded constructor with four parameters to assign values to each of the variables declared

vii) Set methods for each of the data members

viii) Get methods for each of the variables         
 
Question2. Write down an application to perform the following:-

i) Create a 'Weather' object using the no-argument constructor

ii) Create a second 'Weather' object using the overloaded constructor one parameter

iii) Create a third 'Weather' object using the overloaded constructor two parameters

iv) Create a fourth 'Weather' object using the overloaded constructor three parameters

v) Create a fifth 'Weather' object using the overloaded constructor four parameters

vi) Use the set methods to assign values to each of the variables declared

vii) Display the values using message dialog(s)

Question3. Write down the interface 'WaterResource' to contain the following:-

Method 'water_amount' of datatype double

Method 'resource_name' of datatype String                                         

Question4. Write down the class 'Reservoir' which implements the interface 'WaterResource' and contains the following:-

i) String variables: name and location

ii) Variables: capacity and amount_available of datatype double

iii) Set methods for each of the variables

iv) Get methods for each of the variables

v) Override the two methods inherited from the interface WaterResource

Question5. Write down the class 'Lake' which inherits from the class 'Reservoir' and contains the following:-

i) A variable area_size of datatype double

ii) A set method to assign value to the area_size

iii) A get method to return the value of area_size

iv) Override the method water_amount inherited from superclass Reservoir to indicate the amount of water available in the lake.

v) Override the method resource_name  inherited from superclass  Reservoir  to return the name of the resource, that is lake.

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: Class reservoir which implements interface waterresource
Reference No:- TGS05887

Expected delivery within 24 Hours