Question: PYTHON CODE Create a system where we will work with the temperature of seasons. Implement the system in such a way where users can increase

PYTHON CODE

Create a system where we will work with the temperature of seasons. Implement the system in such a way where users can increase the temperature of a season, decrease the temperature of a season, display the temperature of a season and display the info of a season. Here we will work with 2 seasons 1) Summer 2) Winter Both of the seasons will have three common attributes. 1) Season name (this will be a string) 2) Months ( this will be a list) 3) Year Note #1: 1) Maximum temperature for summer is 40 degree Celsius. 2) Minimum temperature for summer is 25 degree Celsius.

Note #2: 1) Maximum temperature for winter is 25 degree Celsius. 2) Minimum temperature for winter is 4 degree Celsius.

What you need to do: 1) Create an abstract class Season which will have these private instance variables; season_name, months, year a. Create a constructor that takes initial value for those attributes and initializes those attributes. Create the following methods as described a. display() - This method displays the attributes in this format- Season name: season_name Months: months Year: year b. Create getter/setter methods for all these private attributes. c. Create an abstract method increaseTemperature() d. Create another abstract method decreaseTemperature() e. Create another abstract method getTemperature() 2) Create a Summer class and make it a child of Season class. Now do the following. a. Create a constructor that takes initial value for attributes season_name, months, year, temperature b. Inside the constructor, call the parent classs constructor to pass season_name, months, year. Add a new private attribute temperature and set the temperature. This is the initial temperature of the season. Now you can increase and decrease the temperature by implementing the following two methods. c. increaseTemperature( amount ) - Check if the temperature crosses the maximum limit of 40 degree if increased. - If it does not cross the limit, then increase the temperature by amount. - Otherwise print a statement Maximum temperature limit reached. d. decreaseTemperature( amount ) - Check if the temperature crosses the minimum limit of 25 degree if decreased. - If it does not cross the limit, then decrease the temperature by amount. - Otherwise print a statement Minimum temperature limit reached. e. getTemperature() - return the temperature f. display() - display the followings

Season name: season_name Months: months Year: year Temperature: temperature 3) Create a Winter class and make it a child of Season class. Now do the following. a. Create a constructor that takes initial value for attributes season_name, months, year, temperature b. Inside the constructor, call the parent classs constructor to pass season_name, months, year. Add a new private attribute temperature and set the temperature. This is the initial temperature of the season. Now you can increase and decrease the temperature by implementing the following two methods. c. increaseTemperature( amount ) - Check if the temperature crosses the maximum limit of 25 degree if increased. - If it does not cross the limit, then increase the temperature by amount. - Otherwise print a statement Maximum temperature limit reached. d. decreaseTemperature( amount ) - Check if the temperature crosses the minimum limit of 4 degree if decreased. - If it does not cross the limit, then decrease the temperature by amount. - Otherwise print a statement Minimum temperature limit reached. e. getTemperature() - return the temperature f. display() - display the followings Season name: season_name Months: months Year: year Temperature: temperature 4) Now in main method, for each of the classes do the followings- a) create an object b) print the season name c) print the months d) print the year e) set the year f) print the year g) increase the temperature ( so that does not cross the limit) h) print the temperature i) decrease the temperature (so that does not cross the limit) j) print the temperature

k) increase the temperature ( so that crosses the limit) l) print the temperature m) decrease the temperature (so that crosses the limit) n) print the temperature o) display all info

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!