1 / 9

Objective 7.03 Apply Built-in Math Class Functions

Objective 7.03 Apply Built-in Math Class Functions. Computer Programming I. Image taken from: http://www.stsd.org/webpages/cyurconic/news.cfm?subpage=67815. Objects/Classes and Methods in Visual Basic . An object is a structure containing data and methods that manipulate the data.

avian
Download Presentation

Objective 7.03 Apply Built-in Math Class Functions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Objective 7.03 Apply Built-in Math Class Functions Computer Programming I Image taken from: http://www.stsd.org/webpages/cyurconic/news.cfm?subpage=67815

  2. Objects/Classes and Methods in Visual Basic  An objectis a structure containing data and methods that manipulate the data. Almost everything you do in Visual Basic is associated with objects. If you are new to object-oriented programming, the following terms and concepts will help you get started. Classes and Objects The words "class" and "object" are used so much in object-oriented programming that it is easy to get the terms mixed up. Generally speaking, a class is an abstract representation of something, whereas an object is a usable example of the thing the class represents.

  3. Objects/Classes and Methods in Visual Basic  Methods – Functions Methods are operations that can be performed on data. A method may take some input values through its parameters and may return a value of a particular data type. There are two types of methods in VB: Sub Procedures and Functions.For this Unit, we will discuss two built in classes with built in Functions: The Math and String classes.

  4. Math Class Functions • The Math class provides programmers with numerous built-in functions. • We will only look at a few of these functions. • Abs(num) • Returns the absolute value of a positive or negative number • Sqrt(num) • Returns the square root of a number • Sign(num) • Returns the sign of a number • Round (num, places) • Returns number nearest to the specified value. Image taken from: http://www.amazingclassroom.com/templates/blue_business/math_1.asp?cag=sample1

  5. Using Abs(num) • The Abs() function returns the absolute value of the number and works with the following data types: • Decimal, Double, Integer, Single Image taken from: http://withlovero.com/2012/05/15/absolute-value-17-2/

  6. Using Sqrt(num) • Sqrt(num) Returns the square root of a number as a double Image taken from: http://keep3.sjfc.edu/students/anb02630/e-port/vsg/virtual%20strudy%20guide%2021.html

  7. Using Sign(num) • The Sign() function works with the following data types: • Decimal, Double, Int16, Int32, Int64, SByte, Single Image taken from: https://www.honors.umass.edu/event/last-day-adddrop

  8. Round Function • The Round() function works with either a decimal or a double. The variable/value that represents the number of places should be an Integer. Note that 5 does round up here.

  9. More info? • This PowerPoint provided an overview of several methods in the Math class in Visual Studio. • For more information on this topic • http://msdn.microsoft.com/en-us/library/32s6akha(v=VS.90).aspx • http://msdn.microsoft.com/en-us/library/system.math.aspx

More Related