Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function addBags(input) {
- let priceOver20kg = Number(input[0]);
- let bagWeight = Number(input[1]);
- let dayBefore = Number(input[2]);
- let bagCount = Number(input[3]);
- if (bagWeight < 10) {
- priceOver20kg /= 5;
- } else if (bagWeight <= 20) {
- priceOver20kg /= 2;
- }
- if (dayBefore < 7) {
- priceOver20kg *= 1.4;
- } else if (dayBefore <= 30) {
- priceOver20kg *= 1.15;
- } else if (dayBefore > 30) {
- priceOver20kg *= 1.1;
- }
- let total = priceOver20kg * bagCount;
- console.log(` The total price of bags is: ${total.toFixed(2)} lv. `);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement