Design a class named Fan to represent a fan. The class contains: Three constants named SLOW,
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, 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.
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang