Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.suarez;
- public class Box
- {
- private int width;
- private int length;
- public Box() //Default constructor
- {
- width =1;
- length =1;
- }
- public Box(int width1, int length1)
- {
- width = width1;
- length = length1;
- }
- public void setWidth(int width1)
- {
- width = width1;
- }
- public void setLength(int length1)
- {
- length = length1;
- }
- public int getWidth()
- {
- return width;
- }
- public int getLength()
- {
- return length;
- }
- public int CalulateArea()
- {
- return (width*length);
- }
- public int CalculateVolume(int height)
- {
- return (height*width*length);
- }
- public void toString(int area, int volume)
- {
- System.out.println("Area = "+area+" Volume = "+volume);
- }
- }
Add Comment
Please, Sign In to add comment