BOT_Yokel

ICS3U1 Unit 1 Activity 3: Question 2

Jul 11th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // This line makes the button, btnCalculate wait for a mouse click
  2. // When the button is clicked, the displayDebtBurden function is called
  3. btnCalculate.addEventListener(MouseEvent.CLICK, displayDebtBurden);
  4.  
  5. // This is the displayDebtBurden function
  6. // e:MouseEvent is the click event experienced by the button
  7. // void indicates that the function does not return a value
  8. function displayDebtBurden(e:MouseEvent):void
  9. {
  10.     // declare the constants
  11.     const INITIAL:Number = 481.5;
  12.  
  13.     // declare the variables
  14.     var year2007:Number;
  15.     var year2008:Number;
  16.     var year2009:Number;
  17.     var year2010:Number;
  18.  
  19.     // calculate the debt burden per year
  20.     year2008 = INITIAL * 0.97
  21.     year2009 = year2008 * 0.97
  22.     year2010 = year2009 * 0.97
  23.  
  24.     // put the values into the labels
  25.     lblyear2007.text = INITIAL.toFixed(1);
  26.     lblyear2008.text = year2008.toFixed(1);
  27.     lblyear2009.text = year2009.toFixed(1);
  28.     lblyear2010.text = year2010.toFixed(1);
  29. }
Add Comment
Please, Sign In to add comment