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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started