Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write program in C++. thanks! CSC326 I. Write a specification for a class called thermostat, that stores and manipulates a simple thermostat. This thermostat has

Write program in C++. thanks! image text in transcribed
CSC326 I. Write a specification for a class called thermostat, that stores and manipulates a simple thermostat. This thermostat has a shutoff point, and then can be set at any degree between 50 and 90. It has one data member (Boolean) which holds whether the thermostat is on or not, and another data member that holds the degree. Two functions examine the status of the thermostat. One tells us whether the thermostat is on or not, and the other tells us on what degree the thermostat is set. If the thermostat is off, the degree at which it is set makes no difference. A function allows us to shut off the thermostat A function allows us to set the thermostat to a specific position. Either make the preconditions of this function that the thermostat is on, or make sure that you check the thermostat and turn it on before changing the temperature. A function allows us to subtract or add degrees by a given amount. Create a class specification and C++ definition that includes both pieces of data and the five functions. 3. 2. Create a header file with the C++ definition, and implement the member functions in members.cpp. Create a main function to test your code. You should declare a variable of type thermostat and then do 4. the following, in function calls. Have a cout statement after each command so that we can see if the class is implemented correctly a) Turn off the thermostat. b) Check to see if it is on/off. c) Set the thermostat to any degree you wish. d) Check to see if it is on/off. e) Set the thermostat to 76. t Check the degrees 8) Raise the thermostat by 2 degrees. h) Check the degrees ) Check to see if it is turned on. i) Lower the thermostat by 8 degrees. k) Check the degrees. I) Turn off the thermostat m) Check to see if it is on/off. Think about: How are you dealing with error checking? What if a user sets the thermostat to 50 and then tries to lowerit by 6 degrees

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Differentiate between hard and soft measures of service quality.

Answered: 1 week ago

Question

Be familiar with the different perspectives of service quality.

Answered: 1 week ago