Advertisement
Guest User

Untitled

a guest
Nov 27th, 2014
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. class Boxf {
  2. double width;
  3. double height;
  4. double depth;
  5.  
  6. }
  7.  
  8.  
  9. class BoxDemo2 {
  10.  
  11. public static void main(String[] args) {
  12. Boxf mybBox1 = new Boxf();
  13. Boxf mybBox2 = new Boxf();
  14. double vol;
  15.  
  16. myBox1.width = 10;
  17. myBox1.height = 20.90;
  18. myBox1.depth = 15.75;
  19. vol = myBox1.width * myBox1.height * myBox1.depth;
  20.  
  21. System.out.println("Volume1 is = "+ vol);
  22.  
  23. myBox2.width= 10;
  24. myBox2.height = 20.90;
  25. myBox2.depth = 15.75;
  26. vol = myBox2.width * myBox2.height * myBox2.depth;
  27. System.out.println("Volume2 is = "+ vol);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement