-
Notifications
You must be signed in to change notification settings - Fork 0
/
AppObject.js
41 lines (29 loc) · 874 Bytes
/
AppObject.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
function App(n,m,s){
//Declare your instance variables here.
this.name = n
this.memory = m
this.state = s
//Declare the instance function open here.
this.open = function(){
this.state = "active";
}
};
//Declare the instance function sleep here.
this.sleep = function(){
if(this.state == "active"){
this.state = "sleep";
this.memory = this.memory/2;
}
};
//Declare the instance function active here.
this.active = function(){
if(this.state == "sleep"){
this.state = "active";
this.memory = this.memory*2;
}
};
//Declare the instance function close here.
}
//Use the constructor to create 4 App objects below.
//Declare an array named appList, and place all 4 of your apps in that array.
//The order does not matter.