Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Document Format ( 2 attachments)

PDF file Icon
636618d71b646_240781.pdf

180 KBs PDF File

Word file Icon
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

Recommended Textbook for

Introduction to Java Programming, Comprehensive Version

Authors: Y. Daniel Liang

10th Edition

133761312, 978-0133761313

More Books

Students also viewed these Programming questions

Question

Establish identity. cos( + k) = (-1)k cos , k any integer

Answered: 1 week ago