fork download
  1. class Box
  2. attr_accessor :height
  3. attr_accessor :length
  4. attr_accessor :breadth
  5. end
  6.  
  7. Box1 = Box.new
  8. Box2 = Box.new
  9. volume = 0.0
  10.  
  11. Box1.height = 5.0;
  12. Box1.length = 6.0;
  13. Box1.breadth = 7.0;
  14.  
  15. Box2.height = 10.0;
  16. Box2.length = 12.0;
  17. Box2.breadth = 13.0;
  18.  
  19. volume = Box1.height * Box1.length * Box1.breadth;
  20. puts("Volume of Box1: #{volume}");
  21.  
  22. volume = Box2.height * Box2.length * Box2.breadth;
  23. puts("Volume of Box1: #{volume}");
Success #stdin #stdout 0.02s 7452KB
stdin
Standard input is empty
stdout
Volume of Box1: 210.0
Volume of Box1: 1560.0