-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCylinder.java
More file actions
73 lines (45 loc) · 1.04 KB
/
Cylinder.java
File metadata and controls
73 lines (45 loc) · 1.04 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package com.mycompany.box;
import java.text.DecimalFormat;
public class Cylinder extends CicrcleIn
{
private double height;
public Cylinder()
{
super(10, "Red");
height = 1.0 ;
}
public Cylinder(double height)
{
super(10,"Red");
this.height = height;
}
public Cylinder(double height,double radius)
{
super(10,"Red");
this.height = height;
this.setRadius(radius);
}
public Cylinder(double height,double radius,String color)
{
super(10,"Red");
this.height = height;
this.setRadius(radius);
super.setColor(color);
}
public double getHeight() {
return height;
}
public void setHeight(double height) {
this.height = height;
}
public double getvolume()
{
return super.getArea() * this.height ;
}
@Override
public String toString()
{
DecimalFormat df = new DecimalFormat("#.##");
return "Volume is: " + df.format(this.getvolume());
}
}