Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <script type="text/javascript">;
- //Program name: Hands-On Activity 4-1 (javascript)
- //Purpose: Ca,cluating Percentages increases in sales from 2010 to 2011
- //Author: Alex Pannunzio
- //Date last modified: 08-Feb-2016
- // Declaring variables for sales in 2010, 2011 and the % increase from 2010 to 2011
- var sales2010;
- var sales2011;
- var percentIncrease;
- var percentdifrence
- var BR = "<br />"; // html line break
- // Welcome the User
- document.write("Welcome to the % increase Calclueator" + BR);
- //Asking the user to imput the % for both years
- sales2010 = prompt("Please enter the percent of sales for 2010: ");
- sales2011 = prompt("Thanks, now enter the percent of sales for 2011:");
- //calcuate percent increase
- percentdifrence = sales2011 - sales2010;
- percentIncrease = (percentdifrence / sales2010) * 100;
- //Displaying the percent increase
- document.write("The sales price increase is " + percentIncrease + "% growth this year" + BR);
- //close program
- document.write("Thanks for using my program");
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement