-
Notifications
You must be signed in to change notification settings - Fork 0
/
note.txe
174 lines (135 loc) · 3.61 KB
/
note.txe
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
1) class - movie
class Movie{
constructor(title,studio,rating){
this.title = title;
this.studio =studio;
if(rating == undefined){
this.rating = "PG13";
} else{
this.rating = rating;
}
}
getPG(arry){
var result =[];
for(var i=0;i<arry.length; i++){
if(arry[i].rating == "PG"){
result.push(arry[i]);
}
}
return result;
}
}
var movie = new Movie("soorarai potru","2d entertainment");
var movie2 = new Movie("vikram","rkfi","PG17");
var movie3= new Movie("soorarai","2d");
var movie4 = new Movie("kaithi","dwp","PG192");
var arr = [movie,movie2,movie3,movie4];
console.log(movie2.getPG(arr));
------------------------------------------------------------------------------------------------
2) Circle - Class
class Circle{
constructor(radius,color){
this.radius = radius;
this.color = color;
}
get radiusofCircle(){
return this.radius;
}
set radiusofCircle(radius){
this.radius = 20;
}
get colorCircle(){
return this.color;
}
set colorCircle(color){
this.color = color;
}
get tostring(){
return`circle[radius ${this.radius} color ${this.color}]`;
}
get areaCicle(){
return Math.PI * this.radius * this.radius;
}
get Circumference(){
return 2* Math.PI * this.radius ;
}
}
var ras = new Circle(1.0,"red");
console.log(ras.radiusofCircle);
ras.radiusofCircle = 20
console.log(ras.radiusofCircle);
console.log(ras.colorCircle);
ras.colorCircle = "black";
console.log(ras.colorCircle);
-----------------------------------------------------------------------
3)class Person
class Person{
constructor(name){
this.name = name;
}
}
var arr = new Person(`
name: mathankumar
gender : male
age : 20
height : 164
weight : 53
color : white
education : mech(diploma) , devaloper
hobby : video editing , flim making , music`
);
console.log(arr.name);
-----------------------------------------------------------------------------------
4) class uber price
class Uberprice{
constructor(passenger,place,distance,time){
if(passenger === String){
this.passenger = "error"
}
else if(passenger ==0){
this.passenger = "error";
}
else if(passenger == 1){
this.passenger =
`vehicle type :bike
pick place :${place}
distance : ${distance}
cost : ${distance* 5}Rs
vehicle speed : 40 kmhr
starting time : ${time}`;
}
else if (passenger <4) {
this.passenger = `vehicle type :hatchback
pick place :${place}
distance : ${distance}
cost : ${distance* 8}Rs
vehicle speed : 75 kmhr
starting time : ${time}`;
}
else if ( passenger<7){
this.passenger = `vehicle type :suv
pick place :${place}
distance : ${distance}
cost : ${distance* 10}Rs
vehicle speed : 80 kmhr
starting time : ${time}`;
}
else if (passenger <9){
this.passenger = `vehicle type :mpv
pick place :${place}
distance : ${distance}
cost : ${distance* 12}Rs
vehicle speed : 80 kmhr
starting time : ${time}`;
}
else {
this.passenger = "Enter a valid passenger";
}
if(distance <15 ){
this.distance= distance * 5;
}
this.time = time;
}
}
var obj1 = new Uberprice(8,"dharapuram",30,8.00);
console.log(obj1.passenger) ;