-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPractice09_Contructors.java
More file actions
109 lines (89 loc) · 2.14 KB
/
Practice09_Contructors.java
File metadata and controls
109 lines (89 loc) · 2.14 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package com.company;
//1.
//class cylinder{
// int height;
// int radius;
//
// public int getHeight() {
// return height;
// }
// public void setHeight(int height) {
// this.height = height;
// }
//
// public int getRadius(){
// return radius;
// }
// public void setRadius(int radius) {
// this.radius = radius;
// }
// 2.
// public float sarea(){
// float k = 2* 3.14f * radius * height;
// float l = 2* 3.14f * radius * radius;
// float a = k + l ;
// return a;
// }
// public float vol(){
// float k = 3.14f * radius * radius * height;
// return k;
// }
// 3.
// public cylinder(int height, int radius) {
// this.height = height;
// this.radius = radius;
// }
//}
//class rectangle{
// int height;
// int breath;
//
// public rectangle(int height, int breath) {
// this.height = height;
// this.breath = breath;
// }
//}
//5.
//class square{
// int side;
//
// public int parameter(){
// int i = 4 * side;
// return i;
// }
// public int area(){
// int k = side * side;
// return k;
// }
//}
public class Practice09_Contructors {
public static void main(String[] args) {
// 1.
// cylinder c = new cylinder();
// c.setHeight(5);
// c.setRadius(5);
// System.out.println(c.getHeight());
// System.out.println(c.getRadius());
// 2.
// System.out.println(c.sarea());
// System.out.println(c.vol());
// 3.
// cylinder r = new cylinder(5,5);
// System.out.println(r.sarea());
// System.out.println(r.vol());
// 4.
// rectangle b = new rectangle(4,6);
// System.out.println(b.breath);
// System.out.println(b.height);
// b.breath = 5;
// b.height = 4;
// System.out.println(b.breath);
// System.out.println(b.height);
// 5.
// square s = new square();
// s.side = 5;
// System.out.println(s.side);
// System.out.println(s.area());
// System.out.println(s.parameter());
}
}