-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestion 2.txt
More file actions
56 lines (35 loc) · 993 Bytes
/
Copy pathQuestion 2.txt
File metadata and controls
56 lines (35 loc) · 993 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
44
45
46
47
48
49
50
51
52
53
54
55
56
class Circle {
constructor(radius = 1.0, color = "red") {
this._radius = radius;
this._color = color;
}
getRadius() {
return this._radius;
}
setRadius(radius) {
this._radius = radius;
}
getColor() {
return this._color;
}
setColor(color) {
this._color = color;
}
toString() {
return `Circle[radius=${this._radius}, color=${this._color}]`;
}
getArea() {
return Math.PI * Math.pow(this._radius, 2);
}
getCircumference() {
return 2 * Math.PI * this._radius;
}
}
const circle1 = new Circle();
console.log(circle1.toString());
const circle2 = new Circle(3.5, "blue");
console.log(circle2.getArea());
console.log(circle2.getCircumference());
console.log(circle2.toString());
Thank You
....................................***...............................................