Advertisement
Guest User

tennis

a guest
Feb 27th, 2020
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve(input){
  2.     let tennisRacketPrice = Number(input.shift());
  3.     let tennisRacketsCount = Number(input.shift());
  4.     let pairSneakers = Number(input.shift());
  5.  
  6.     let totalTennisRacketsPrice = tennisRacketPrice * tennisRacketsCount
  7.     let sneakersPrice = (tennisRacketPrice / 6) * pairSneakers
  8.     let equipmentPrice = (totalTennisRacketsPrice + sneakersPrice) * 0.2
  9.  
  10.     let finalPrice = totalTennisRacketsPrice + sneakersPrice + equipmentPrice
  11.  
  12.     let djokovicPayment = finalPrice / 8
  13.     let sponsorsPayment = finalPrice - djokovicPayment
  14.  
  15.     console.log(`Price to be paid by Djokovic ${Math.floor(djokovicPayment)}`)
  16.     console.log(`Price to be paid by sponsors ${Math.ceil(sponsorsPayment)}`)
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement