Problem

(The Fan class) Design a class named Fan to represent a fan. The class contains:■ An int d...

(The Fan class) Design a class named Fan to represent a fan. The class contains:

An int data field named speed that specifies the speed of the fan. A fan has three speeds indicated with a value 1 , 2 , or 3.

A bool data field named on that specifies whether the fan is on.

A double data field named radius that specifies the radius of the fan.

A no-arg constructor that creates a default fan with speed 1 , on false , and radius 5.

The accessor and mutator functions for all the data fields.

Draw the UML diagram for the class. Implement the class. Write a test program that creates two Fan objects. Assign speed 3 , radius 10 , and turn it on to the first object. Assign speed 2 , radius 5 , and turn it off to the second object. Invoke their accessor functions to display the fan properties.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT