Skip to content

Commit 56e3e97

Browse files
committed
feat: Add Expression3 class to calculate surface area and volume of a cuboid
Add a program that: - Takes length, breadth, and height as input from the user - Calculates the total surface area using the formula: 2(lb + lh + bh) - Computes the volume using the formula: l × b × h - Demonstrates integer input handling and geometric formula application in Java.
1 parent 8a198ff commit 56e3e97

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import java.util.Scanner;
22

33
public class Expression3 {
4-
public static void main(String args[]){
4+
public static void main(String args[]) {
55
Scanner sc = new Scanner(System.in);
66

7-
int length, breadth, height;
8-
int totalArea,volume;
7+
int length, breadth, height; //taken from input.
8+
int totalArea,volume; //calculate and store the output into the variable.
99

10-
System.out.print("Enter Length breadth and Height ");
10+
System.out.print("Enter Length breadth and Height: ");
1111

1212
length=sc.nextInt();
1313
breadth=sc.nextInt();
@@ -20,4 +20,4 @@ public static void main(String args[]){
2020
System.out.println("Total area: "+ totalArea);
2121
System.out.println("Volume: "+volume);
2222
}
23-
}
23+
}

0 commit comments

Comments
 (0)