aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/example/BoxModel.java
blob: 0dd4e6506d59f284f90516e0e290e25f79dc7d7f (plain)
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
44
45
46
47
48
package com.example;

public class BoxModel {
    private double width;
    private double height;
    private double depth;
    
    private double area;
    private double volume;

    public BoxModel(double width, double height, double depth) {
        this.width = width;
        this.height = height;
        this.depth = depth;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {
        return height;
    }

    public void setHeight(double height) {
        this.height = height;
    }

    public double getDepth() {
        return depth;
    }

    public void setDepth(double depth) {
        this.depth = depth;
    }

    public double getVolume(){
        return this.width * this.height * this.depth; 
    }

    public double getArea(){
        return 2 * (this.width * this.height + this.width * this.depth + this.height * this.depth);
    }
}