Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let w = Number(input.shift());
- let h = Number(input.shift());
- let d = Number(input.shift());
- let ticket = input.shift();
- let volumeLuggage = w * h * d;
- tax = 0;
- if (volumeLuggage >= 50 && volumeLuggage <= 100) {
- if (ticket === "priority") {
- tax = 25;
- }
- } else if (volumeLuggage >= 100 && volumeLuggage <= 200) {
- if (ticket === "priority") {
- tax = 10;
- } else {
- tax = 50;
- }
- } else if (volumeLuggage >= 200 && volumeLuggage <= 300) {
- if (ticket == "priority") {
- tax = 20;
- } else {
- tax = 100;
- }
- }
- console.log(`Luggage tax: ${tax.toFixed(2)}`);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement