Answer to Question #318651 in C++ for simii

Question #318651

Create a class heater that contains a single integer field temperature. Define a constructor that takes no parameter. The temperature field should be set to the value 15 in the constructor. Define the mutates warmer and cooler, whose effect is to increase or decrease the value of the temperature by 5.


1
Expert's answer
2022-03-26T14:01:50-0400
class Heater {
public:
    int temperature;

    Heater() {
        temperature = 15;
    }

    void warmer() {
        temperature+=5;
    }

    void cooler() {
        temperature-=5;
    }
};

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS