-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
175 lines (133 loc) · 3.24 KB
/
script.js
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
175
//Task-1
/*
// Task-1.a
class Movie{
constructor(title,studio,rating){
this.title = title;
this.studio = studio;
this.rating = rating;
}
}
const movie_a = new Movie("Leave_The_World_Behind","Netflix-Studio","R");
console.log(movie_a.title,movie_a.studio,movie_a.rating);
*/
/*
//Task-1.b
class Movie{
constructor(title,studio,rating = "PG"){
this.title = title;
this.studio = studio;
this.rating = rating;
}
}
const movie_b = new Movie("Mouse","Blue-Dragon");
console.log(movie_b.title,movie_b.studio,movie_b.rating);
*/
/*
//Task-1.c
class Movie{
constructor(title,studio,rating = "PG"){
this.title = title;
this.studio = studio;
this.rating = rating;
}
static getPG(movie){
const rating = movie.filter((movie)=>movie.rating==="PG")
console.log(rating);
}
}
const movie = [
new Movie("Casino_Royal","EON_Production","PG-13"),
new Movie("Vikram","RKFI","U/A"),
new Movie("Batman","WB"),
new Movie("Master","7-Screen"),
new Movie("Interstellar","WB","PG-13")
];
Movie.getPG(movie);
*/
/*
//Task-1.d
class Movie{
constructor(title,studio,rating){
this.title = title;
this.studio = studio;
this.rating = rating;
}
}
const movie = new Movie("Casino_Royal","EON_Production","PG-13");
console.log(movie.title,movie.studio,movie.rating);
*/
//Task - 2
/*
class Circle{
constructor(radius,color){
this.radius = radius;
this.color = color;
}
get Radius(){
return this.radius;
}
set Radius(r){
this.radius = r;
}
get Color(){
return this.color;
}
set Color(c){
this.color = c;
}
get toString(){
return `"Circle[radius = ${this.radius}, color = ${this.color}]"`;
}
get Area(){
return Math.PI*Math.pow(this.radius,2);
}
get Circumference(){
return 2*Math.PI*this.radius
}
}
const circle = new Circle(1.0,"red");
console.log(circle.radius,circle.color);
console.log(circle.toString);
console.log(circle.Area);
console.log(circle.Circumference);
circle.Radius = 24
circle.Color = "Green"
console.log(circle.Radius);
console.log(circle.Color);
console.log(circle.toString);
console.log(circle.Area);
console.log(circle.Circumference);
*/
/*
// Task - 3
class Person{
constructor(name,age,gender,m_status,contact,email){
this.name = name;
this.age = age;
this.gender = gender;
this.m_status = m_status;
this.contact = contact;
this.email = email;
}
}
const person1 = new Person("Umar",23,"male","single",9876543210,"abc@example.com");
const person2 = new Person("wazim",23,"male","married",9876541230,"def@example.com");
console.log(person1.name,person1.age,person1.gender,person1.m_status,person1.contact,person1.email);
console.log(person2.name,person2.age,person2.gender,person2.m_status,person2.contact,person2.email);
*/
//Task-4
class Uber{
constructor(km,price=50){
this.km = km;
this.price = price;
}
set Price(price){
this.price = price;
}
get Price(){
return this.km*this.price;
}
}
const uberPrice = new Uber(10,50);
console.log(uberPrice.Price);