Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve(input) {
- let km = Number(input.shift());
- let time = input.shift();
- let taxiPrice = 0.70 + 0.79 * km;
- let taxiPriceNigt = 0.70 + 0.90 * km;
- let busPrice = 0.09 * km;
- let trainPrice = 0.06 * km;
- if (time === "night"){
- if (km < 20) {
- console.log(taxiPrice.toFixed(2));
- }else if (km < 100){
- console.log(busPrice.toFixed(2));
- }else{
- console.log(trainPrice.toFixed(2));
- }
- }else{
- if(km < 20 ){
- console.log(taxiPriceNigt.toFixed(2));
- }else if(km < 100){
- console.log(busPrice.toFixed(2));
- }else{
- console.log(trainPrice.toFixed(2));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement