Question: 1/Write a test program that does the following: 110 Creates two Fan objects. 1/6 Assigns maximum speed, radius 10, color yellow to the first object.
1/Write a test program that does the following: 110 Creates two Fan objects. 1/6 Assigns maximum speed, radius 10, color yellow to the first object. 1/8 Turns first object on. // After first object is turned on, it increases its speed. 1/8 Assigns medium speed, radius 5, color blue to the second object. 1/8 Turns second object on. 1/0 Then decreases its speed twice 1/B After that it turns it off. 1/2 Displays the two objects by invoking their toString() method. \/class Fan // public Fan() () // public int getSpeed() //return 1/} 1/public boolean getOn() //{return 1/public double getRadius() //{return radius;} //public String getColor() //{return color;) 1/public void setSpeed(int speed) // (this. -;} 1/public void setOn(boolean on) {this.on - on;} 1/public void setRadius(double radius) //{this. //public void setColor(String color) 1/ (this.color = color;) 1/public String toString() { // return getOn() ? + radius + inch " + color + " fan at a speed of radius + inch + color + fan; fan is off"; + speed
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
