Skip to content

Commit 4c73ff0

Browse files
authored
v1.9
1 parent 35afdda commit 4c73ff0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Gas.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
class Gas {
2+
constructor(name, amount) {
3+
this.name = name;
4+
this.amount = amount;
5+
6+
switch(name) {
7+
case "H2":
8+
this.boilingPoint = 1;
9+
break;
10+
case "He":
11+
this.boilingPoint = 0.8;
12+
break;
13+
}
14+
}
15+
16+
getAmount() {
17+
return this.amount;
18+
}
19+
getName() {
20+
return this.name;
21+
}
22+
23+
setAmount(x) {
24+
this.amount = x;
25+
}
26+
setName(x) {
27+
this.name = x;
28+
}
29+
30+
formatGas() {
31+
return "You have " + this.amount + " " + this.name + " molecules.";
32+
}
33+
}

0 commit comments

Comments
 (0)