forked from cs-dept-ibbul/java2019
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab6Boxmodify.java
More file actions
43 lines (43 loc) · 1.33 KB
/
Copy pathlab6Boxmodify.java
File metadata and controls
43 lines (43 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Write a description of class BoxModify here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class BoxModify
{
private double length , width , height; //instance variables
public BoxModify(double boxLength , double boxWidth , double boxHeight) { //constructor
length = boxLength;
width = boxWidth;
height = boxHeight;
}
public BoxModify(BoxModify obj) { //constructor
length = obj.length;
width = obj.width;
height = obj.height;
}
public BoxModify(double boxLength) { //constructor
length = boxLength;
width = boxLength;
height = boxLength;
}
public double volume() { //instant methods
return length * width * height;
}
public double surfaceArea() {
return 2*(length*width + length*height + width*height);
}
public double getLength( ){
return length;
}
public double getWidth(){
return width;
}
public double getHeight(){
return height;
}
public String toString() {
return "\nLength: "+getLength()+" Width: "+getWidth()+" Height:"+getHeight();
}
}