The Fan class) Design a class named Fan to represent a fan. The class contains: The Fan class Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed. A private int data field named speed specifies the speed of the fan (the default is SLOW). A private boolean data field named on that specifies whether the fan is on (the default is false). A private double data field named radius that specifies the radius of the fan (the default is 5). A string data field named color specifies the color of the fan (the default is blue). Accessor and mutator methods for all four data fields. A no-arg constructor that creates a default Fan. A method named toString() that returns a string description for the fan.
The Fan class) Design a class named Fan to represent a fan. The class contains: The Fan class Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed. A private int data field named speed specifies the speed of the fan (the default is SLOW). A private boolean data field named on that specifies whether the fan is on (the default is false). A private double data field named radius that specifies the radius of the fan (the default is 5). A string data field named color specifies the color of the fan (the default is blue). Accessor and mutator methods for all four data fields. A no-arg constructor that creates a default Fan. A method named toString() that returns a string description for the fan.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter9: Records (struct)
Section: Chapter Questions
Problem 12SA
Related questions
Question
100%
9.8 (The Fan class) Design a class named Fan to represent a fan.
The class contains:
- The Fan class Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed.
- A private int data field named speed specifies the speed of the fan (the default is SLOW).
- A private boolean data field named on that specifies whether the fan is on (the default is false).
- A private double data field named radius that specifies the radius of the fan (the default is 5).
- A string data field named color specifies the color of the fan (the default is blue).
- Accessor and mutator methods for all four data fields.
- A no-arg constructor that creates a default Fan.
- A method named toString() that returns a string description for the fan.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning