AreWe

part2 nqkvo gorivo

Jan 28th, 2020
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. (input) => {
  2. let type = input.shift(), vol = Number(input.shift()), hasCard = input.shift() === 'Yes';
  3. let prices = { 'Gasoline': hasCard ? 204 : 222, 'Diesel': hasCard ? 221 : 233, 'Gas': hasCard ? 85 : 93 };
  4. let money = prices[type] * vol * ( vol >= 20 && vol <= 25 ? 0.92 : vol > 25 ? 0.9 : 1);
  5. console.log(`${(money/100).toFixed(2)} lv.`);
  6. }
Advertisement
Add Comment
Please, Sign In to add comment