We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
class Calculate
{
Output output=new Output();
double volume=0.0d;
public double main(int a)
{
volume=a*a*a;
return volume;
}
public double main(int a,int b,int c)
{
volume=a*b*c;
return volume;
}
public double main(double r)
{
volume=((double)2/3)*Math.PI*r*r*r;
return volume;
}
public double main(double r,double h)
{
volume=Math.PI*r*r*h;
return volume;
}
public static Calculate get_Vol()
{
Calculate cal=new Calculate();
return cal;
}
public int getINTVal() throws NumberFormatException, IOException
{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
int ch=Integer.parseInt(br.readLine().trim());
String s=new Integer(ch).toString();
if(s.startsWith("-"))
throw new NumberFormatException("All the values must be positive");
return ch;
}
public double getDoubleVal() throws NumberFormatException, IOException
{ BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
double ch=Double.parseDouble(br.readLine().trim());
String s=new Double(ch).toString();
if(s.startsWith("-"))
throw new NumberFormatException("All the values must be positive");
return ch;
Detect the Email Addresses
You are viewing a single comment's thread. Return to all comments →
class Calculate { Output output=new Output(); double volume=0.0d; public double main(int a) {
public double main(double r,double h) {
public static Calculate get_Vol() {
Calculate cal=new Calculate();
} public int getINTVal() throws NumberFormatException, IOException { BufferedReader br =new BufferedReader(new InputStreamReader(System.in)); int ch=Integer.parseInt(br.readLine().trim()); String s=new Integer(ch).toString(); if(s.startsWith("-")) throw new NumberFormatException("All the values must be positive"); return ch;
}
}
class Output { public void display(double volume) { String s=new Double(volume).toString(); String str[]=s.split("\."); if(str[1].length()==1) { s=s+"00"; } else if(str[1].length()==2) s=s+"0"; else if(str[1].length()>3) { volume=Math.round(volume * 1000.0) / 1000.0;
s=new Double(volume).toString(); } System.out.println(s); }
}
this is my code am getting output in my ide but not here please someone help