Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function transport([arg1, arg2]) {
- km = Number(arg1);
- if (arg2 == "day") {
- dayPrice = 0.79;
- nightPrice = 0;
- } else {
- nightPrice = 0.90;
- dayPrice = 0;
- }
- priceTaxi = (0.70 + km * dayPrice + km * nightPrice);
- priceBus = 0.09 * km;
- priceTrain = 0.06 * km;
- if ((priceTaxi <= priceBus && priceTaxi <= priceTrain) || km < 20) {
- console.log(priceTaxi);
- } else if ((priceBus <= priceTaxi && priceBus <= priceTrain) || km < 100) {
- console.log(priceBus);
- } else if (priceTrain <= priceTaxi && priceTrain <= priceBus && km >= 100) {
- console.log(priceTrain);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement