Chapter 8.  Visual Basic includes several built-in mathematical functions ◦ Abs ◦ Sqr ◦ Sgn ◦ IsNumeric ◦ Round ◦ Format ◦ Pmt ◦ PV ◦ FV.

Slides:



Advertisements
Similar presentations
Lesson 4 Study Guide Review Microsoft Office 2003.
Advertisements

Microsoft Visual Basic: Reloaded Chapter Seven More on the Repetition Structure.
6-1 CHAPTER 28 Time Value of Money The language of Finance The most important lesson.
Chapter 3 The Time Value of Money © 2005 Thomson/South-Western.
Introduction to Finance
Learning Objectives Explain the mechanics of compounding, and bringing the value of money back to the present. Understand annuities. Determine the future.
Chapter 4: The Selection Structure Programming with Microsoft Visual Basic.NET, Second Edition.
Lab4 ListBox Control Properties, Methods and Events.
VB Default Controls List Box, Combo Box
XP New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 2 1 Microsoft Office Excel 2003 Tutorial 2 – Working With Formulas and Functions.
REVIEW Midterm Review ICS 101 Fall Inserting a Function.
1 Committed to Shaping the Next Generation of IT Experts. Chapter 4: Spreadsheets in Decision Making: What If? Robert Grauer and Maryann Barber Exploring.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab5 ListBox Control Properties, Methods and Events.
Repeating Program Instructions Chapter Microsoft Visual Basic.NET: Reloaded 1.
1 Computing for Todays Lecture 8 Yumei Huo Spring 2006.
Copyright © 2001 by Wiley. All rights reserved. Chapter 3: Variables, Assignment Statements, and Arithmetic Variables Assignment Statements Arithmetic.
McGraw-Hill/Irwin The Interactive Computing Series © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Microsoft Excel 2002 Exploring Formulas.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 9 Car Payment Calculator Application Introducing the Do While...Loop and Do Until...Loop.
Chapter 9: Mathematics of Finance
Access Level Three [Functions] & “ And “ & [Expressions]
Chapter 13 Creating Formulas for Financial Applications Microsoft Office Excel 2003.
XP Excel Tutorial 3 Working with Formulas and Functions.
Financial Functions. Working with Loans and Investments =PMT(rate, nper, pv, [fv=0] [type=0]) =FV(rate, nper, pmt, [pv=0] [type=0]) =NPER(rate, pmt, pv,
XP Abdul Hameed 1 Microsoft Office Excel 2013 Tutorial 2 – Working With Formulas and Functions.
With Microsoft Excel 2007 Comprehensive 1e© 2008 Pearson Prentice Hall1 Chapter 5: PowerPoint Presentation GO! with Microsoft Excel ® 2007 Comprehensive.
210 – Payment Function Buying a Car – The ABC’s So you want to buy a car! We must first look at all the variables! Car Price, Down Payment, Interest.
Chapter 12: How Long Can This Go On?
COMPUTER PROGRAMMING I Objective 7.03 Apply Built-in Math Class Functions.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Seven More on the Repetition Structure.
Chapter 5 The Time Value of Money. Copyright ©2014 Pearson Education, Inc. All rights reserved.5-1 Learning Objectives 1.Explain the mechanics of compounding,
Copyright © 2001 by Wiley. All rights reserved. Chapter 5: The Repetition Process in Visual Basic Event Driven Loops Determinate Loops Indeterminate Loops.
Computer Science & Engineering 4194 Day 9 Financial Functions 1.
© 2012 EMC Publishing, LLC Slide 1 Chapter 7 The Math Class  Includes shared methods that perform common math functions.  Math Class methods include:
COMPUTER PROGRAMMING I Objective 7.03 Apply Built-in Math Class Functions Image taken from:
Exploring Office 2003 Vol 1 2/e - Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Chapter 4: Spreadsheets in Decision Making:
Annuities Chapter 11 2 Annuities Equal Cash Flows at Equal Time Intervals Ordinary Annuity (End): Cash Flow At End Of Each Period Annuity Due (Begin):
Chapter 6.  If a cell style will be used over and over again it can be modified in the cell styles gallery  Home ⇒ Cell Styles ⇒ right-click a style.
© 1999, by Que Education and Training, Appendix A, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
Spring Final Review Excel and PowerPoint. Excel Functions – IF computer chooses between alternatives = if ( condition, true section, false section ) 
Data Types and Variables. Data Type! Computers are all about Data! Data can be in the form of Text Dates Sounds Pictures.
The Time Value of Money. Future Value Investment Interest or Yield Yield 10% Investment $1, ___x ___ 10 =.1== $100 Annual Yield 10% = 50%
Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined.
XP 1 Microsoft Office Excel 2003 Working With Formulas and Functions.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 4 Working with Variables, Constants, Data Types, and Expressions.
Controlling Program Flow with Looping Structures
5-1 Computing APRs What is the APR if the monthly rate is.5%? What is the APR if the semiannual rate is.5%? What is the monthly rate if the APR is 12%
Computer Science & Engineering 2111 Lecture 6 Financial Functions 1.
Variables and Expressions Programming Right from the Start with Visual Basic.NET 1/e 7.
Controlling Program Flow with Decision Structures.
Chapter 4 Decision Making. Agenda Function Goal Seek command AutoFilter command Worksheet operation Printing worksheet.
Math 1320 Chapter 2: The Mathematics of Finance 2.2 Compound Interest.
COMPUTER PROGRAMMING I Objective 7.04 Apply Built-in Math Class Functions.
Chapter 5 Time Value of Money. Basic Definitions Present Value – earlier money on a time line Future Value – later money on a time line Interest rate.
Chapter 4.  Variables – named memory location that stores a value.  Variables allows the use of meaningful names which makes the code easier to read.
© 2006 Lawrenceville Press Slide 1 Chapter 4 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration.
Slide 1 Chapter 3 Variables  A variable is a name for a value stored in memory.  Variables are created using a declaration statement. For example: Dim.
Understanding and Appreciating the Time Value of Money
COMPUTER PROGRAMMING I Apply Procedures to Develop List Box and Combo Box Objects.
Built-in Functions in Excel Financial Functions MAN Micro-computers & Their Applications.
1 Financial Functions By Prof. J. Brink with modifications by L. Murphy 1/13/2009.
Time Value of Money Basics and Building Blocks
Microsoft Visual Basic 2008: Reloaded Third Edition
Tutorial 3 Working with Formulas and Functions
Microsoft Excel.
Tutorial 9 - Car Payment Calculator Application Introducing the while Repetition Statement Outline 9.1 Test-Driving the Car Payment Calculator Application.
Excel Formatting Rules
Session 3 TIME VALUE OF MONEY
Microsoft Visual Basic 2005: Reloaded Second Edition
Chapter 2: Working with Formulas and Functions
Lesson 7 Objectives Use the IF function. Use the PMT and FV functions.
Presentation transcript:

Chapter 8

 Visual Basic includes several built-in mathematical functions ◦ Abs ◦ Sqr ◦ Sgn ◦ IsNumeric ◦ Round ◦ Format ◦ Pmt ◦ PV ◦ FV

 Returns the absolute value of a number  Form: Abs(number)  Example: Dim intNum As Integer intNum = -5 lblAnswer.Caption = Abs(intNum) ‘ 5 will be displayed

 Returns the square root of a number  You can not take a square root of a negative number  Form: Sqr(number)  Example: Dim intNum As Integer intNum = 9 lblAns.Caption = Sqr(intNum) ‘ 3 will be displayed

 Returns 1,-1,or 0 when the numeric argument is positive, negative or 0 respectively.  Form: Sgn(number)  Example: Dim intNum As Integer intNum = -5 lblAns.Caption = Sgn(intNum) ‘-1 is displayed intNum = 3 lblAns.Caption = Sgn(intNum) ‘1 is displayed

 Returns True if its argument can be evaluated as a number and False if it cannot.  Form: IsNumeric(argument)  Example: Dim strString As String strString = “123” lblAns.Caption = IsNumeric(strString) ‘True strString = “abc” lblAns.Caption = IsNumeric(strString) ‘False lblAns.Caption = IsNumeric(“2+4”) ‘False lblAns.Caption = IsNumeric(2+4) ‘ True

 Rounds numeric data to specified number of decimal places.  Form: Round(number, decimal places)  Example: Dim dblNum As Double dblNum = lblAns.Caption = Round(dblNum, 2) ‘3.46 will be displayed

 Used to format, or change the appearance of, numeric data.  Form: Format(number, “format type”)  Examples: lblAns.Caption = Format(8789, “General Number”) ‘8789 lblAns.Caption = Format(8789, “Currency”) ‘$8, lblAns.Caption = Format(8789, “Fixed”) ‘ lblAns.Caption = Format(8789, “Standard”) ‘8, lblAns.Caption = Format(89, “Percent”) ‘ % lblAns.Caption = Format(1, “Yes/No”) ‘Yes lblAns.Caption = Format(0, “True/False”) ‘False lblAns.Caption = Format(1, “On/Off”) ‘On

 Three business Built-in function Pmt(rate, term, principal) PV(rate, term, payment) FV(rate, term, investment)

Returns the periodic payment for an installment loan. Rate- is the interest rate per period Term – is the total number of payments to be made Principal – is the amount borrowed Example: Calculate the monthly payments on a 30 – year, $100,000 loan with an annual interest rate of 6%. dblPay = Pmt(0.06/12, 360, ) lblAns.Caption = Format(dblPay, “Currency”) ‘$ ***Since payments are monthly, the interest rate must also be computed monthly by dividing the annual rate interest 6% by 12. ***The principal is negative because it is the amount borrowed.

Returns the present value of an investment. Rate- is the interest rate per period Term – is the total number of payments to be made Payment – amount invested per period Example: Determine the cost of financing a car. $250 per month over a 4 year period is applied to a loan with an interest rate of 8%. dblAmount = 250 * 12 * 4 ‘12000 dblPresent = PV(0.08/12, 48, -250) ‘ dblFin = dblAmount – dblPresent lblAns.Caption = Format(dblFin, “Currency”) ‘$1, ***This means that $1, is spent on Financing

Returns what a series of equal payments invested at a fixed interest will be worth after a period of time. Rate- is the interest rate per period Term – is the total number of payments to be made Investment – is the amount invested per period Example: You invest $500 per month in a retirement plan earning 8% interest per year. What would it be worth in 20 years. dblFuture = FV(0.08/12, 240, -500) lblAns.Caption = Format(dblFuture, “ Currency”) ‘$294,510.21

 Allows the user to select a value from a set of values.  Use the Icon to create a List Box Properties of a List Box Name – use the prefix “lst” for the name List – stores a group of strings that makes up the list. Sorted – displays the item in the list in alphabetical order. (Design Time only) Text – stores the selected list item. (Run Time Only) ListCount – can be used at run time to determine number of items in the list.

 Click Event – is executed when the user clicks on an item in the list box.  AddItem Method – is used to add an item to the list ◦ Example: lstControl.AddItem Item ◦ lstControl – is the name of the list and item is a string object or string double quotes added to the list box  Clear – delete List Box contents of the list. ◦ Example: lstControl.Clear

 Also called collapsible list  The icon is used to create it.  Properties: Name – use the prefix “cbo” for the name List – stores a group of strings that makes up the items in the combo box. Sorted – displays the item in the combo box in alphabetical order. (Design Time only) Text – stores the selected item in the combo box. (Run Time Only) ListCount – can be used at run time to determine number of items in the combo box Style – dropdown combo, simple combo, or dropdown list. Runtime use vbComboDropDown, vbComboSimple, or vbComboDrop-DownList.

 Click Event – is executed when the user clicks on an item in the combo box.  AddItem Method – is used to add an item to the list ◦ Example: cboControl.AddItem Item ◦ cboControl – is the name of the list and item is a string object or string double quotes added to the list  Clear – delete Combo Box contents of the list Example: cboControl.Clear