Question: A thermostat is a device that keeps a system at a constants temperature. It behaves like a temperature gauge that is capable of getting the

A thermostat is a device that keeps a system at a constants temperature. It behaves like a temperature gauge that is capable of getting the current temperature from the system. It is also a switch that can be turned "on" and "off". The thermostat monitors the temp. in the following manner : if the current temp. falls below 95% of the required temp., it turns itself "on". On the other hand , if the current temp. exceeds 1.05 of the required temp. ,it turns itself "off" .In all other cases ,its on-off status remain un changed. Implement classes for temp. gauge and switch(named switch) with suitable data and member functions. The temp. gauge class must have a member function get_temp() that will pretend to get the current temp. of the system by actually reading it from the keyboard. Now, implement thermostat class in both the following ways: Develop a class called thermostat that include objects of temp. gauge and switch as its member (aggregation). Develop a class called thermostat that inherits the data functions of temp. gauge and switch(multiple inheritance). Write main ( ) to test all the features of above-mentioned classes

programming language is c++

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!