Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function checking(input){
- let puzzlePrice = 2.60, priceTalkingDoll = 3.00, priceTedyBear = 4.10,
- priceMinion = 8.20, priceTruck = 2.00, discount = 0.00, rent = 0.00, profit = 0.00;
- let excursionPrice = Number(input[0]), puzzle = parseInt(input[1]), talkingDoll = parseInt(input[2]),
- tedyBear = parseInt(input[3]), minion = parseInt(input[4]), truck = parseInt(input[5]);
- let order = (puzzle + talkingDoll + tedyBear + minion + truck);
- let amount = ((puzzle * puzzlePrice) + (talkingDoll * priceTalkingDoll) +
- (tedyBear * priceTedyBear) + (minion * priceMinion) + (truck * priceTruck));
- if(order >= 50){
- discount = amount * 0.25;
- }
- rent = ((amount - discount) * 0.10);
- profit = ((amount - discount) - rent);
- if(profit >= excursionPrice){
- console.log(`Yes! ${(profit - excursionPrice).toFixed(2)} lv left.`)
- }
- else{
- console.log(`Not enough money! ${(excursionPrice - profit).toFixed(2)} lv needed.`)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement