class Fan{
public final static int SLOW = 11;
public final static int MEDIUM = 12;
public final static int FAST = 13;
int speed=Fan.SLOW;
boolean fOn = false;
int radius = 4;
String color = "blue";
Fan(){
}
Fan(int speed, boolean status, int radius, String color){
this.speed= speed;
this.fOn = status;
this.radius = radius;
this.color= color;
}
void display(){
if(this.fOn==true){
System.out.println("\n\nSpeed is "+this.speed);
System.out.println("Color is "+this.color);
System.out.println("Radius is "+this.radius);
}else{
System.out.println("\n\nColor is "+this.color);
System.out.println("Radius is "+this.radius);
System.out.println("Fan is Off");
}
}
}
class TestFan{
public static void main(String[] args){
Fan f1 = new Fan();
Fan f2 = new Fan(Fan.MEDIUM, true, 6, "Brown");
f1.display();
f2.display();
}
}
public final static int SLOW = 11;
public final static int MEDIUM = 12;
public final static int FAST = 13;
int speed=Fan.SLOW;
boolean fOn = false;
int radius = 4;
String color = "blue";
Fan(){
}
Fan(int speed, boolean status, int radius, String color){
this.speed= speed;
this.fOn = status;
this.radius = radius;
this.color= color;
}
void display(){
if(this.fOn==true){
System.out.println("\n\nSpeed is "+this.speed);
System.out.println("Color is "+this.color);
System.out.println("Radius is "+this.radius);
}else{
System.out.println("\n\nColor is "+this.color);
System.out.println("Radius is "+this.radius);
System.out.println("Fan is Off");
}
}
}
class TestFan{
public static void main(String[] args){
Fan f1 = new Fan();
Fan f2 = new Fan(Fan.MEDIUM, true, 6, "Brown");
f1.display();
f2.display();
}
}
No comments:
Post a Comment