forked from rishavraj12321/Constructor_Overloading
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCode.java
More file actions
43 lines (38 loc) · 797 Bytes
/
Copy pathCode.java
File metadata and controls
43 lines (38 loc) · 797 Bytes
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
/*Rishav Raj
* 2017182
*/
import java.util.Scanner;
public class Box {
double length,breadth,height;
public Box()
{
length=0.0;
breadth=0.0;
height=0.0;
}
public Box(double length,double breadth,double height)
{
this.length=length;
this.breadth=breadth;
this.height=height;
}
public Box(double parameter)
{
this.length=parameter;
this.breadth=parameter;
this.height=parameter;
}
public Double Volume()
{
return this.length*this.breadth*this.height;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Box A=new Box();
System.out.println(A.Volume());
Box B=new Box(8.0,7.0,2.0);
System.out.println(B.Volume());
Box C=new Box(3.0);
System.out.println(C.Volume());
}
}