-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
62 lines (52 loc) · 1.38 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
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(6,"dharapuram",30,8.00);
console.log(obj1.passenger)