-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
137 lines (103 loc) · 2.91 KB
/
script.js
File metadata and controls
137 lines (103 loc) · 2.91 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
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
class Movie {
constructor(title,studio,rating="PG"){
this.title = title; //key: value // leo = title
this.studio = studio;
this.rating = rating;
}
}
const obj = new Movie("leo","7-Screen Studio","7.2");
const obj1 = new Movie("vikram","RKFI","8.5")
console.log("TASK 1 a) Part");
console.log(obj.title,obj.studio,obj.rating);
console.log(obj1.title,obj1.studio,obj1.rating);
console.log(" ");
console.log("TASK 1 b) Part");
console.log("**********Give the parameter Without Rating************");
const obj2 = new Movie("Ayan","AVM Production")
console.log(obj2.title,obj2.studio,obj2.rating);
console.log(" ");
console.log("TASK 1 c) Part");
console.log("**********to print movie if the rating = PG************");
const list = [
new Movie("Kaithi","7screen","PG"),
new Movie("3","scs","5.5"),
new Movie("kgf","homele","PG"),
new Movie("kgf2","7screen","PG"),
new Movie("salar","homele","4.5")
]
const res = list.filter((ele)=>ele.rating==="PG")
console.log(res);
console.log(" ");
console.log("TASK 1 d) Part");
const obj3 = new Movie("Casino Royale","Eon Productions","PG13")
console.log(obj3.title,obj3.studio,obj3.rating);
console.log(" ");
console.log("Task 2");
class circle{
constructor(radius,color){
this.radius=radius
this.color=color
}
get Radius(){
return this.radius
}
set Radius(n){
this.radius=n
}
get Color(){
return this.color
}
set Color(n){
this.color=n
}
get toString(){
return `"Circle[radius= ${this.radius}, color = ${this.color}]"`
}
get area(){
return Math.PI*Math.pow(this.radius,2)
}
get curcumference(){
return 2*Math.PI*this.radius
}
}
const Circle = new circle(1.0,"green")
console.log(Circle.Radius)
console.log(Circle.Color)
console.log(Circle.toString)
console.log(Circle.area)
console.log(Circle.curcumference)
console.log(" ");
console.log("Task 3");
class Person{
constructor(name,age,gender,martialstatus,contact,email){
this.name = name;
this.age = age;
this.gender= gender;
this.martialstatus = martialstatus;
this.contact= contact
this.email=email
}
}
const detail = new Person("Deepakmuthu",20,"Male","Single","9566752004","deepakmuthu21@gmail.com")
console.log(`${detail.name},
${detail.age},
${detail.gender},
${detail.martialstatus},
${detail.contact},
${detail.email}`);
console.log(" ");
console.log("Task 4");
class uber{
constructor(ActualKM,PricePerKM = 25){
this.ActualKM=ActualKM
this.PricePerKM=PricePerKM
}
set KiloMeter(n){
this.PricePerKM=n
}
get Price(){
return this.PricePerKM*this.ActualKM
}
}
const calculate = new uber(50)
console.log(`your distance is ${calculate.ActualKM} Kilometer And Charge of the uber is ${calculate.Price}`);