Design a class named Fan to represent a fan. The class contains: n 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 radius5. 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.
Design a class named Fan to represent a fan. The class contains:
n 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 radius5.
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.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images