- Test Time Left 01 47 01 Design A Class Named Fan To Represent A Fan The Class Contains The Following Members The S 1 (146.98 KiB) Viewed 19 times
Test time left: 01:47:01 Design a class named Fan to represent a Fan. The class contains the following members : ● The s
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Test time left: 01:47:01 Design a class named Fan to represent a Fan. The class contains the following members : ● The s
Test time left: 01:47:01 Design a class named Fan to represent a Fan. The class contains the following members : ● The speed of the Fan is represented by three constants named variables SLOW, MEDIUM, and FAST having the values of 1, 2, and 3 respectively. • The speed of the fan can be represented by data field of type int. (The default is set to SLOW). • The state of the Fan like On or Off can be stored in a private Boolean data field (The default is false). • The colour of the fan can be stored in the string type of variable named colour. (The default colour is white). • The setter and getter methods for all three data fields. A no-arg constructor that creates the default fan. • A method named display() will display a description for the fan. If the fan is on, the display() method displays the speed and colour of the fan. If the fan is not on, the method returns the fan colour "fan is off". Write a test program that creates two Fan objects. One with default values and the other with medium speed, colour brown, and turned on status true. Display the descriptions for two created Fan objects.