Consider a class named Fan to represent a fan. The class contains • Three constants named, SLOW, MEDIUM, and FAST with values 1, 2, and 3, respectively, to denote the fan speed. • An integer data...



Consider a class named Fan to represent a fan. The class contains


• Three constants named, SLOW, MEDIUM, and FAST with values 1, 2, and 3, respectively, to denote the fan speed.


• An integer data field named speed that specifies the speed of the fan; the default value is SLOW.


• A boolean data field named isOn that specifies whether the fan is on; the default value is false.


• A real data field named radius that specifies the radius of the fan in inches; the default value is 5.


• A string data field named color that specifies the color of the fan; the default value is gray.


• A default constructor that creates a default fan.


• A method named toString that returns a string description for the fan as follows. If the fan is on, the string contains "On" as well as the fan speed, color, and radius. If the fan is off, the string contains "Off" as well as the fan color and radius. Define the beginning of this class, including the data fields, a default constructor, and the method toString.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here