Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions Module_1/week1/Fan and TestFanApp.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
class Fan
{
public static final int SLOW=1,STOPPED=0,MEDIUM=2,FAST=3;
boolean f_on;
int speed;
String color;
double radius;
Fan()
{
f_on=false;
speed=STOPPED;
color="WHITE";
radius=6;
}
Fan(int speed,double radius,String color,boolean f_on)
{
this.f_on=f_on;
this.speed=speed;
this.color=color;
this.radius=radius;
}
void Showdata()
{
if(f_on==true)
{
System.out.println("Fan is on \n the speed is ="+speed+"\n the color is ="+color+"\n the radius is ="+radius);
}
else
{
System.out.println("Fan is off \n the color of fan is ="+color+"\n the radius of fan is ="+radius);
}
}
public static void main(String [] args)
{
Fan objt = new Fan();
Fan objt1 = new Fan(MEDIUM,8,"bLUE",true);
objt.Showdata();
objt1.Showdata();
}
}