Question: Design a class named Fan to represent a fan. The class contains: Three constants named SLOW, MEDIUM, and FAST with the values 1, 2,


Design a class named Fan to represent a fan. The 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 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 red).
■ A no-arg constructor that creates a default fan. red).
■ Getters and Setters for each field, making sure to perform appropriate data validation prior to making changes to any field.
■ A method named toString() that returns a string summary of the current status of your fan.

Step by Step Solution

3.44 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

class Fan public static final int SLOW1MEDIUM2FAST3 int speed boolean fo... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Document Format (2 attachments)

PDF file Icon

636618d71b646_240781.pdf

180 KBs PDF File

Word file Icon

636618d71b646_240781.docx

120 KBs Word File

Students Have Also Explored These Related Programming Questions!