Advertisement
nikolayneykov

Untitled

May 29th, 2019
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (fundamentals, advanced, applications, educationForm) {
  2.   let [totalPrice, fundPrice, advancedPrice, appsPrice] = [0, 170, 180, 190]
  3.  
  4.   if (fundamentals && advanced) {
  5.     advancedPrice *= 0.9
  6.   }
  7.  
  8.   if (fundamentals && advanced && applications) {
  9.     totalPrice = (fundPrice + advancedPrice + appsPrice) * 0.94
  10.   } else {
  11.     totalPrice += fundamentals ? fundPrice : 0
  12.     totalPrice += advanced ? advancedPrice : 0
  13.     totalPrice += applications ? appsPrice : 0
  14.   }
  15.  
  16.   if (educationForm === 'online') {
  17.     totalPrice *= 0.94
  18.   }
  19.  
  20.   console.log(Math.round(totalPrice))
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement