04. Toy shop
Къде може да е проблема за да не го приема Judge системата? Тестове 2, 5 и 8 излизат грешни, но не показва къде е проблема..
function moneyTripQuestion(input) {
const jigsaw = 2.6;
const doll = 3;
const bear = 4.10;
const minion = 8.20;
const truck = 2;
let tripPrice = parseFloat(input[0]);
let jigs = parseInt(input[1]);
let dolls = parseInt(input[2]);
let bears = parseInt(input[3]);
let minions = parseInt(input[4]);
let trucks = parseInt(input[5]);
let sumToys = (jigsaw * jigs) + (doll * dolls) +
(bear * bears) + (minion * minions) + (truck * trucks);
let toys = jigs + dolls + bears + minions + trucks;
if (toys >= 50) {
discount = sumToys * 0.25;
} else {
discount = 0;
}
let finalSum = sumToys - discount;
let rent = finalSum * 0.1;
let income = finalSum - rent;
let leftSum = Math.abs(income - tripPrice);
if (leftSum > tripPrice) {
console.log(`Yes! ${(leftSum).toFixed(2)} lv left.`);
} else {
console.log(`Not enough money! ${(leftSum).toFixed(2)} lv needed.`)
}
}
uno online follows the same rules and gameplay mechanics as the physical version of the game.