A. Create a class named Fan to represent a fan. This class contains;
* 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 that 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 private String data field named color that specifies the color of the fan (the default is green).
* A no-arg constructor that creates a default fan.
* The accessor and mutator methods for all four data fields. (for Windows click alt + insert)
* A method named toString() that returns the following string description for the fan; If the fan is on, the method returns the fan speed, color, and radius along with the string “fan is on” in one combined string. If the fan is not on, the method returns the fan speed, color and radius along with the string “fan is off" in one combined string.
Try to use one line If Statement "(condition) ? TrueExpression : FalseExpression" ;)
B. Write a test program that creates two Fan objects.
1. First object: assign maximum speed, radius 10, color yellow, and turn it on.
2. Second object: assign medium speed, radius 5, color blue, and turn it off.
* Display these objects by invoking their toString method *
C. Draw the UML diagram for Fan class. (Using LucidChart)
Class Fan:
Class OOP_assignment2:
UML Class diagram:

need an explanation for this answer? contact us directly to get an explanation for this answer