Program to find area of rectangle using Interface

Program to find area of rectangle  using Interface

interface Area  //interface defined
{
    float pi=3.14F;
    float compute(float x, float y);
}

class Rectangle implements Area
{
public float compute (float x, float y)
{
return(x*y);
}

void message()
{
System.out.println("Hi...this is first program based on interface");
}

}

/*class Triangle implements Area
{
public float compute(float x, float y)
{
return(pi*x*x);
}
}*/
class InterfaceTest1
{
public static void main(String args[])
{
Rectangle rect=new Rectangle();
rect.message();
System.out.println("Area of rectangle : "+rect.compute(5,10));
}
}
/*
Hi...this is first program based on interface
Area of rectangle : 50.0
*/

3 comments:

Anonymous said...

It's going to be ending of mine day, however before end I am reading this fantastic post to improve my know-how.

Also visit my web page: cellulite treatment reviews

Anonymous said...

replica bags in bangkok fake hermes e3k47l4k66 replica bags ru Continued c7w41v3a07 replica louis vuitton replica bags south africa q1n66j5l01 7a replica bags philippines gucci fake h4o73u5v90 replica bags toronto

Anonymous said...

s9c19d0p70 f0i96k6s62 c5b66w6g91 a6p29w8x77 u4u02j7h92 r8u92h4w97

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|