-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparacons.java
More file actions
40 lines (35 loc) · 839 Bytes
/
paracons.java
File metadata and controls
40 lines (35 loc) · 839 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
package mypro;
import java.util.*;
class box4{
double width;
double height;
double depth;
box4(double w, double h, double d){
width=w;
height=h;
depth=d;
}
double volume() {
return width*height*depth;
}
}
class boxdemo8{
public static void main(String args[]) {
double w,h,d;
System.out.println("Constructing box");
Scanner sc= new Scanner(System.in);
System.out.println("Enter Width: ");
w=sc.nextDouble();
System.out.println("Enter height: ");
h=sc.nextDouble();
System.out.println("Enter depth: ");
d=sc.nextDouble();
box4 mybox=new box4(w,h,d);
box4 mybox2=new box4(w,h,d);
double vol;
vol=mybox.volume();
System.out.println("Vol of box1: "+vol);
vol=mybox2.volume();
System.out.println("Vol of box2: "+vol);
}
}