nikolayneykov

Untitled

May 30th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function solve (fundamentals, advanced, applications, educationForm) {
  2.   let fundamentalsP = 170
  3.   let advancedP = 180
  4.   let applicationsP = 190
  5.  
  6.   let price = 0
  7.  
  8.   if (fundamentals === true && advanced === true) {
  9.     advancedP *= 0.9
  10.   }
  11.  
  12.   if (fundamentals === true && advanced === true && applications === true) {
  13.     price = (fundamentalsP + advancedP + applicationsP) * 0.94
  14.   } else {
  15.     if (fundamentals === true) {
  16.       price += fundamentalsP
  17.     }
  18.     if (advanced === true) {
  19.       price += advancedP
  20.     }
  21.     if (applications === true) {
  22.       price += applicationsP
  23.     }
  24.   }
  25.  
  26.   if (educationForm === 'online') {
  27.     price *= 0.94
  28.   }
  29.  
  30.   console.log(Math.round(price))
  31. }
Advertisement
Add Comment
Please, Sign In to add comment