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 values 1,2, and 3 to

image text in transcribed
image text in transcribed
Design a class named Fan to represent a fan. The class contains: >Three constants named SLoW, MEDIUM, and FAST with values 1,2, and 3 to denote the fan speed. >An int data field named speed that specifies the speed of the fan (default SLOW). > A boolean data field named on that specifies whether the fan is on (default is false). > A double data field named radius that specifies the radius of the fan (default 5). > A string data field named color that specifies the color of the fan (default blue). > An int static data field named numberOfObjects (default 0). > A no-arg constructor that creates a default fan A constructor with four parameters (speed, on, radius and color) with the appropriate data types that will be able to a fan object with user desired speed, on-off status, radius and color The get(accessor) and set(mutator) methods for all four data fields: speed, on, radius and color. >A static getNumberOfObjects method to return the data field numberOfObjects. A method named toString0 that returns a string description for the fan. If the fan is on, the method returns the fan speed, color, and radius in one combined string. If the fan is not on, the method returns fan color and radius along with the string "fan is off" in one combined string. Requirements 1. Draw the UML diagram for the Fan class. Then implement the Fan class. variable-within set-metheds andt Write a test program, the TestFan class, that creates two Fan objects and do the following ment. 3. tasks. a. Assign maximum speed, radius 10, color yellow, and turn it on for the first fan

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Step: 3

blur-text-image

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

More Books

Students also viewed these Databases questions

Question

=+9-4 Describe how neurotransmitters influence behavior,?

Answered: 1 week ago