Lesson 5 Exponentiation,Order of Operations and Error Handling
Exponentiation Is the process of raising a number to a power. The symbol that represents exponentiation is the caret ^ For example: 2 raise to the 16 th power is written as: 2 ^ 16
Order of Operations Rules: 1. Operations with parentheses are calcuated first. 2.Exponentiation. 3.Unary plus and minus. 4.Multiplication and division/integer division, MOD. 5.Addition and subtraction.
What is the result of the calcuation below? 2 * * 3 4 / * 2 4 / (2 + 6) * 2 4 * – * 3 – * 3 – 9 / 3 12 / * 2 – 5 ( 5 + 7) / * 2 – / 2 – 16 / * 6
Answers are:
Start VB! Open Interest file from Lesson 5.
Double click the calculate button and enter the following code. 'Calculate future value lblTotal.Caption = Fix(Val(txtDeposit.Text) * _ (1 + (Val(txtInterest.Text) / 100)) ^ Val(txtYears.Text)) 'Repeat the number of years saved in the output lblYearsSaved.Caption = Val(txtYears.Text)
Run your program and fix your bugs! Enter the following data into the form Amount Deposited 8 Interest Rate of % 15 Number of years saved Save your program!
Homework! Read pages 82 to 94. Answer the True/False questions on page 96.