Advertisement
Guest User

Untitled

a guest
Feb 8th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.15 KB | None | 0 0
  1. <html>
  2.   <body>
  3.     <script type="text/javascript">;
  4.     //Program name: Hands-On Activity 4-1 (javascript)
  5.     //Purpose: Ca,cluating Percentages increases in sales from 2010 to 2011
  6.     //Author: Alex Pannunzio
  7.     //Date last modified: 08-Feb-2016
  8.  
  9.  
  10.     // Declaring variables for sales in 2010, 2011 and the % increase from 2010 to 2011
  11.     var sales2010;
  12.     var sales2011;
  13.     var percentIncrease;
  14.     var percentdifrence
  15.     var BR = "<br />"; // html line break
  16.     // Welcome the User
  17.     document.write("Welcome to the % increase Calclueator" + BR);
  18.  
  19.     //Asking the user to imput the % for both years
  20.     sales2010 = prompt("Please enter the percent of sales for 2010: ");
  21.     sales2011 = prompt("Thanks, now enter the percent of sales for 2011:");
  22.  
  23.     //calcuate percent increase
  24.     percentdifrence = sales2011 - sales2010;
  25.     percentIncrease = (percentdifrence / sales2010) * 100;
  26.  
  27.     //Displaying the percent increase
  28.     document.write("The sales price increase is " + percentIncrease + "% growth this year" + BR);
  29.  
  30.     //close program
  31.     document.write("Thanks for using my program");
  32.  
  33.     </script>
  34.   </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement