Advertisement
sahadat49

Boxdemo

Aug 18th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. package boxdemo;
  2.  
  3. class box{
  4. int height;
  5. int weight;
  6. double depth;
  7.  
  8. box(int h,int w,double d){
  9. height=h;
  10. weight=w;
  11. depth=d;
  12. }
  13.  
  14. void displyVol(){
  15. double ans = height*weight*depth;
  16. System.out.println(ans);
  17. }
  18.  
  19. }
  20.  
  21. public class Boxdemo {
  22.  
  23. public static void main(String[] args) {
  24. box b1 = new box(10,10,10);
  25. b1.displyVol();
  26.  
  27. box b2 = new box(20,30,10);
  28. b2.displyVol();
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement