Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA programming Hello, I need help with this, please. Thanks Assignment: Write a program with a class titled Fan. This class is to contain: Four

JAVA programming

Hello, I need help with this, please. Thanks

Assignment:

Write a program with a class titled Fan. This class is to contain:

Four constants named STOPPED, SLOW, MEDIUM, and FAST. The constants are to hold the values of 0, 1, 2, and 3 respectively.

A private field named speed that holds one of the constant values with the default being STOPPED.

A private Boolean field titled on that specifies whether the fan is on or off.

A private field named radius that holds the radius of the fan with a default value of 6.

A String field that holds the color, with the default being white.

Setter and getter methods for all mutable fields.

A no-argument constructor that sets all fields with a default value.

A constructor taking arguments and setting values.

Write a toString() method that returns a description of the Fans state.

Write test code that creates two instances of the Fan class, one using the default constructor and the other using the argument constructor. Write code that displays the functionality of the Fan class methods.

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

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions