Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lesson 5 Exponentiation,Order of Operations and Error Handling.

Similar presentations


Presentation on theme: "Lesson 5 Exponentiation,Order of Operations and Error Handling."— Presentation transcript:

1 Lesson 5 Exponentiation,Order of Operations and Error Handling

2 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

3 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.

4 What is the result of the calcuation below? 2 * 3 + 1 1 + 2 * 3 4 / 2 + 6 * 2 4 / (2 + 6) * 2 4 * 4 + 2 – 1 7 + 2 * 3 – 2 1 + 2 * 3 – 9 / 3 12 / 3 + 1 + 12 * 2 – 5 ( 5 + 7) / 3 + 7 * 2 – 5 5 + 8 / 2 – 16 / 2 + 3 * 6

5 Answers are: 7 14 1 17 11 4 24 13 19

6 Start VB! Open Interest file from Lesson 5.

7 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)

8 Run your program and fix your bugs! Enter the following data into the form. 1500 Amount Deposited 8 Interest Rate of % 15 Number of years saved Save your program!

9 Homework! Read pages 82 to 94. Answer the True/False questions on page 96.


Download ppt "Lesson 5 Exponentiation,Order of Operations and Error Handling."

Similar presentations


Ads by Google