import java.util.*;
import java.io.*;
import java.lang.*;
class geoFig
{
double area(double r)
{
return(3.14*r*r); //Cicle
}
import java.io.*;
import java.lang.*;
class geoFig
{
double area(double r)
{
return(3.14*r*r); //Cicle
}
float area(float s)
{
return(s*s); //Square
}
double area(double b,double h)
{
return(0.5*b*h); //Triangle
}
{
return(0.5*b*h); //Triangle
}
}
class geoMain
{
public static void main(String arg[]) throws IOException
{
DataInputStream ob=new DataInputStream(System.in);
geoFig g = new geoFig();
System.out.println("enter double value for radius of circle");
double r=Double.valueOf(ob.readLine()).doubleValue();
System.out.println("area of circle="+g.area(r));
System.out.println("enter float value for side of a square");
float s=Float.valueOf(ob.readLine()).floatValue();
System.out.println("area of square="+g.area(s));
System.out.println("enter double value for base & height of triangle");
double b1=Double.valueOf(ob.readLine()).doubleValue();
double h=Double.valueOf(ob.readLine()).doubleValue();
System.out.println("area of triangle="+g.area(b1,h));
}
{
public static void main(String arg[]) throws IOException
{
DataInputStream ob=new DataInputStream(System.in);
geoFig g = new geoFig();
System.out.println("enter double value for radius of circle");
double r=Double.valueOf(ob.readLine()).doubleValue();
System.out.println("area of circle="+g.area(r));
System.out.println("enter float value for side of a square");
float s=Float.valueOf(ob.readLine()).floatValue();
System.out.println("area of square="+g.area(s));
System.out.println("enter double value for base & height of triangle");
double b1=Double.valueOf(ob.readLine()).doubleValue();
double h=Double.valueOf(ob.readLine()).doubleValue();
System.out.println("area of triangle="+g.area(b1,h));
}
}
No comments :
Post a Comment