-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path06-godzilla-vs-kong.js
23 lines (21 loc) · 985 Bytes
/
06-godzilla-vs-kong.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//06. Godzilla vs. Kong
function solve(budget, statist, clothesPrice) {
budget = Number(budget)
statist = Number(statist)
clothesPrice = Number(clothesPrice)
if (statist >= 150) {
clothesPrice = 0.9 * clothesPrice
if (budget * 0.9 >= clothesPrice * statist) {
console.log("Action!\nWingard starts filming with " + (budget * 0.9 - clothesPrice * statist).toFixed(2) + " leva left.")
} else {
console.log("Not enough money!\nWingard needs " + (clothesPrice * statist - budget * 0.9).toFixed(2) + " leva more.")
}
} else {
if (budget * 0.9 >= clothesPrice * statist) {
console.log("Action!\nWingard starts filming with " + (budget * 0.9 - clothesPrice * statist).toFixed(2) + " leva left.")
} else {
console.log("Not enough money!\nWingard needs " + (clothesPrice * statist - budget * 0.9).toFixed(2) + " leva more.")
}
}
}
solve("9587.88", "222", "55.68");