// // input from file import java.util.Scanner; import java.text.DecimalFormat; class CalPyramid1 { public static void main(String[] args) { Scanner input = new Scanner(System.in); DecimalFormat f2 = new DecimalFormat("0.00"); double base, height, side, sa, vol; //System.out.print("Input base: "); base = input.nextDouble(); //System.out.print("Input height: "); height = input.nextDouble(); side = Math.sqrt( Math.pow(height, 2.) + Math.pow(base*.5, 2.) ); sa = 2. * base * side + base * base; vol = 1./3. * height * base * base; System.out.println("side = " + f2.format(side) ); System.out.println("s.a = " + f2.format(sa) ); System.out.println("vol = " + f2.format(vol) ); } }