You are on page 1of 1

Wipro Talent Next 2021

CLASSES AND OBJECT-ASSIGNMENT


1 class main {
public static double main(String[] args) {
double height;
double width;
double depth;
Box b=new Box();
Scanner s=new Scanner(System.in);
height=s.nextFloat();
width=s.nextFloat();
depth=s.nextFloat();
public Box(double h,double w,double d){
height=h;
width=w;
depth=d;
}
public double getVolume()
double volume = h * w * d;
return volume;
}
}

2 class Calculator {
public static void main(String[] args) {
Calculator.powerInt(1, 2);
Calculator.powerDouble(2, 2);
}

public static double powerDouble(double num1, double num2) {


return Math.pow(num1,num2);
}
public static int powerInt(int num1, int num2) {
return (int) Math.pow(num1,num2);
}
}

You might also like