updated script.js

updated the script with the calculations