Write a program with a class titled fan


Problem

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

A. Four constants named STOPPED, SLOW, MEDIUM, and FAST. The constants are to hold the values of 0, 1, 2, and 3 respectively.
B. A private field named speed that holds one of the constant values with the default being STOPPED.
C. A private Boolean field titled on that specifies whether the fan is on or off.
D. A private field named radius that holds the radius of the fan with a default value of 6.
E. A String field that holds the color, with the default being white.
F. Setter and getter methods for all mutable fields.
G. A no-argument constructor that sets all fields with a default value.
H. A constructor taking arguments and setting values.
I. 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 method

Starting with your code from Module 1 create the following new class titled UseFans:

A. Create a collection of Fan instances.
B. Create a method taking a collection of Fan instances for displaying without using the toString() method.
C. Create a method that takes a single instance of a Fan for displaying without using the toString() method.
D. Use the this reference throughout the Fan class where allowed.
E. Write test code that creates a collection of Fans and displays the functionality of all of the Fan instances in the collection.

Request for Solution File

Ask an Expert for Answer!!
JAVA Programming: Write a program with a class titled fan
Reference No:- TGS03340804

Expected delivery within 24 Hours