Question: Create a class called CeilingFan ( in CeilingFan.java ) that includes a boolean field to indicate whether or not the fan is on , and
Create a class called CeilingFan in CeilingFan.java that includes a boolean field to indicate whether or not the fan is on and an integer field for the speed setting of the fan through Include get methods for each field. A method called setSpeed sets the value of the speed setting and a method called togglePower turns the fan on and off. A method called getEnergyUse returns the amount of energy currently consumed by the fan in watts If the fan is not on it uses watts, regardless of the speed setting. If the fan is on it uses energy based on the speed setting:
watts
watts
watts
watts
Next create a program in TestCeilingFan.java that demonstrates the CeilingFan class by creating an instance of the class and outputting power consumption in a variety of situations onoff & speed settings This program does not require user input.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
