Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

First, create a class and name it Sensor . The Sensor class will contain at leas

ID: 3552276 • Letter: F

Question

First, create a class and name it Sensor.

The Sensor class will contain at least an int field reading and the following methods: setReading, getReading

Method setReading() will generate a reading value between 0 and 100.

Overloaded method setReading( int u) will generate a reading value between 0 and u with

0 <= u <= 100.

Overloaded method setReading( int l, int u) will generate a reading value between l and u with

0 <= l <= u <= 100.

Method getReading() will return the last reading generated.

Create another class TemperatureSensor that will inherit class Sensor and will implement the following methods: getWinterTemp, getSpringTemp, getSummerTemp, getFallTemp.

Method getWinterTemp should return a number between 20-40, getSpringTemp between 40-70, getSummerTemp between 70-90, and getFallTemp between 40-60. These methods must be implemented by calling the super class methods appropriately.

Create another class HumiditySensor that will inherit class Sensor and will implement the following methods: getHumidity, getLowHumidity, getHighHumidity.

Method getHumidity should return a number between 0-100, getLowHumidity between 0-50, getHighHumidity between 50-100. These methods must be implemented by calling the super class methods appropriately.

Create another class SensorsStatsApp that will implement the application.

In the application you will display a menu that will first ask the user what season to simulate (1) winter (2) spring (3) summer (4) fall (5) random (6) exit. Random will choose the season for the user.

After that, another menu will ask the user what type of humidity to simulate (1) full range (2) low (3) high (4) random (5) exit. Random will choose the type of humidity for the user.

Once the use selects the season and the type of humidity your program should ask the user how many simulations to generate. Each simulation will call the corresponding method from the TemperatureSensor and HumiditySensor. Each iteration should display the readings being generated for each temperature and humidity. At the end your program should display a summary of the simulation as follows:

                                                                                                                                

Season: _________ (if random, then display Random:Summer for example)

1-      First temperature generated

2-      Last temperature generated

3-      Lowest temperature generated

4-      Highest temperature generated

5-      Total sum of all temperatures generated

6-      Average for the season

Humidity Type: _________ (if random, then display Random:Full for example)

1-      First humidity reading generated

2-      Last humidity reading generated

3-      Lowest humidity reading generated

4-      Highest humidity reading generated

5-      Total sum of all humidity readings generated

6-      Average humidity reading

Explanation / Answer

Code link for you : http://ideone.com/1dOxUC Ask doubts, if any :)