Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  FAQFAQ  SearchSearch  RegisterRegister  MemberlistMemberlist  UsergroupsUsergroups  Log in  India NewsIndia News  
Keywords
CLASS YEAR 2010 prelim question papers RESULT
Latest topics
Top posters
abhas
 
Anu..i luv icse...:)
 
G-7
 
siya
 
Candy
 
jOhNy
 
Apurva
 
WinRrule
 
ambili
 
saif
 



Search if you can't find it here

ISC XII JAVA Inheritance program to find circles area

View previous topic View next topic Go down
AuthorMessage
abhas
Active member
Active member
avatar


PostSubject: ISC XII JAVA Inheritance program to find circles area Wed Nov 25, 2009 8:00 pm

circle.java

Code:
import java.io.*;
class circle extends point
{
    private double area,radius;
    public void callength()
    {
        Double a,b,c;
        a=Math.pow(x1-x2,2);
        b=Math.pow(y1-y2,2);
        c=a+b;
        radius= Math.pow(c,.5);
       
    }     
    public void cal_area()
    {
        area=(22/7)*radius*radius;
    }
    public void print()
    {
        System.out.println(radius);
        System.out.println(area);
        System.out.println(x1+";"+y1);
        System.out.println(x2+";"+y2);
        }
    circle()throws IOException
    {super.accept();}
}
 

point.java
Code:
import java.io.*;
class point
{
    protected double x1,x2,y1,y2;
    point()
    {
        x1=0;
        x2=0;
        y1=0;
        y2=0;
        }
    public void accept()throws IOException
    {
          BufferedReader inv= new BufferedReader(new InputStreamReader(System.in));
          System.out.println("Enter values");
          x1=Double.parseDouble(inv.readLine());
          x2=Double.parseDouble(inv.readLine());
          y1=Double.parseDouble(inv.readLine());
          y2=Double.parseDouble(inv.readLine());
        }
    }
 
         

Mncir.java
Code:
import java.io.*;
class Mncir
{
public static void main(String args[])throws IOException
{
circle s=new circle();
s.callength();
s.cal_area();
s.print();
}
}
Back to top Go down
View user profile

ISC XII JAVA Inheritance program to find circles area

View previous topic View next topic Back to top
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: ISC :: ISC 2010 [Class xii] :: Computer-