java program to calculate volume of cube and cuboid. (Please send clear and correct answer)
Answers
Surface Area of a Cube as per the formulas.
JAVA CODE
// Java Program to find Volume and Surface Area of Cube
package SurfaceAreaPrograms;
import java.util.Scanner;
public class VolumeOfCube {
private static Scanner sc;
public static void main(String[] args) {
// LSA = Lateral Surface Area of a Cube, SA = Surface Area
float length, SA,Volume, LSA;
sc = new Scanner(System.in);
System.out.println("\n Please Enter the Length of any side of a Cube : ");
length = sc.nextFloat();
SA = 6 * (length * length);
Volume = length * length * length;
LSA = 4 * (length * length);
System.out.format("\n The Surface area of a Cube = %.2f", SA);
System.out.format("\n The Volume of a Cube = %.2f", Volume);
System.out.format("\n The Lateral Surface area of a Cube = %.2f", LSA);
}
}