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
Step: 1
class Fan public static final int SLOW1MEDIUM2FAST3 int speed boolean fo...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Document Format ( 2 attachments)
636618d71b646_240781.pdf
180 KBs PDF File
636618d71b646_240781.docx
120 KBs Word File
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started