Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Boxf {
- double width;
- double height;
- double depth;
- }
- class BoxDemo2 {
- public static void main(String[] args) {
- Boxf mybBox1 = new Boxf();
- Boxf mybBox2 = new Boxf();
- double vol;
- myBox1.width = 10;
- myBox1.height = 20.90;
- myBox1.depth = 15.75;
- vol = myBox1.width * myBox1.height * myBox1.depth;
- System.out.println("Volume1 is = "+ vol);
- myBox2.width= 10;
- myBox2.height = 20.90;
- myBox2.depth = 15.75;
- vol = myBox2.width * myBox2.height * myBox2.depth;
- System.out.println("Volume2 is = "+ vol);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement