Skip to content

Commit a2e273b

Browse files
authored
Create 02-bonus-score.js
1 parent 3a34d00 commit a2e273b

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//02. Bonus Score
2+
function solve(points) {
3+
points = Number(points);
4+
let bonus = 0;
5+
if (points <= 100) {
6+
bonus += 5;
7+
} else if (points > 1000) {
8+
bonus += 0.1 * points;
9+
} else {
10+
bonus += 0.2 * points;
11+
}
12+
if (points % 2 === 0) {
13+
bonus += 1;
14+
} else if (points % 10 === 5) {
15+
bonus += 2;
16+
}
17+
console.log(bonus);
18+
console.log(points + bonus)
19+
}
20+
21+
solve(175);

0 commit comments

Comments
 (0)