ICS 3U Math Class. ActionScript 3 – Math Class Rounding ceil – closest integer >= number (rounds up) floor – closest integer <= number (rounds down) round.

Slides:



Advertisements
Similar presentations
Etter/Ingber Engineering Problem Solving with C Fundamental Concepts Chapter 2 Simple C Programs.
Advertisements

Chapter 4 Methods F Introducing Methods –Benefits of methods, Declaring Methods, and Calling Methods F Passing Parameters –Pass by Value F Overloading.
Java Math Class. What is the Math Class? The Math Class is another class that is prepared by Java for us to use We use this class for mathematical operations.
About Functions SUM, AVERAGE, MIN, MAX, COUNT, ROUND
Building Java Programs
1 MATH METHODS THAT RETURN VALUES. 2 JAVA'S MATH CLASS.
Return values.
MS-Excel XP Lesson 5. Exponentiation 1.A1  2 A2  3 A3  =A1^A2 B1  =2^4 2.^ for exponentiation.
Maths & Trig, Statistical functions. ABS Returns the absolute value of a number The absolute value of a number is the number without its sign Syntax ◦
Divisibility Rules Page 10 in textbook.
COMPSCI 125 Spring 2005 ©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 3: Numeric Data *Variables *Numeric data.
Copyright 2006 by Pearson Education 1 Building Java Programs Chapter 3: Parameters, Return, and Interactive Programs with Scanner.
Numerical Data Recitation – 01/30/2009
CS180 Recitation 3. Lecture: Overflow byte b; b = 127; b += 1; System.out.println("b is" + b); b is -128 byte b; b = 128; //will not compile! b went out.
Chapter 3 Numerical Data. Topics Variables Numeric data types Assignment Expressions.
Chapter 6: User-Defined Functions I
1 Data types, operations, and expressions Continued l Overview l Assignment statement l Increment and Decrement operators l Short hand operators l The.
2-4 Round 3,531 to the nearest hundred.
Microsoft® Small Basic The Math Object Estimated time to complete this lesson: 1 hour.
Area and Circumference of Circles
5.4 – Dividing Decimals Long Division x 46.3 =
Divisibility Rules and Mental Math
Chapter 6: User-Defined Functions I Instructor: Mohammad Mojaddam
Learn: To use divisibility rules. These rules let you test if one number can be evenly divided by another, without having to do too much calculation!
Copyright ©2005  Department of Computer & Information Science Using Number & Math Objects.
CS 115 OBJECT ORIENTED PROGRAMMING I LECTURE 4 part 3 GEORGE KOUTSOGIANNAKIS.
Mt. Rushmore, South Dakota CSE 114 – Computer Science I Static Methods andVariables.
More on Objects. Goals By the end of this unit you should … … be able to identify selected String properties … be able to identify and use selected String.
Chapter 4 Methods F Introducing Methods F Declaring Methods F Calling Methods F Passing Parameters F Pass by Value F Overloading Methods F Method Abstraction.
Java Program Components Java Keywords - Java has special keywords that have meaning in Java. - You have already seen a fair amount of keywords. Examples.
Lesson 1. DefinitionExamples  Ends 0, 2, 4, 6, or 8  1,234  98  456  1,592,342.
1 Math Expressions and Operators. 2 Some C++ Operators Precedence OperatorDescription Higher ( )Function call +Positive - Negative *Multiplication / Division.
1 Week 2: Variables and Assignment Statements READING: 1.4 – 1.6 EECS Introduction to Computing for the Physical Sciences.
DIVISIBILITY RULES.
Divisibility Rules and Finding Factors
Math With Java The Math Class. First, A Quick Review of Math Operators in Java Primitive Data type in Java that represent numbers: Primitive Data type.
ROUND 1 Name a method associated with class String 1.) 15 compareTo() 26 indexOf() 34 length() 2.) 3.) 4.) 3 toUpper() 7 substring() 11 charAt() 5.)
Math – Greatest Common Factor; Factoring by Grouping 1.
Calculations Chapter 11 Library of math functions, and constants cos, sin, tan, abs, min, max, log, random, sqrt, pow, exp Constants.PI,.E Use care with.
CHAPTER 5 FUNCTIONS I NTRODUCTION T O C OMPUTER P ROGRAMMING (CSC425)
1-5 MULTIPLYING AND DIVIDING INTEGERS MS. BATTAGLIA – ALGEBRA 1 CP OBJECTIVE: MULTIPLY AND DIVIDE WITH INTEGERS AND DECIMALS, SIMPLIFY EXPRESSIONS WITH.
Chapter 2: Functions and Models Lesson 7: Step Functions Mrs. Parziale.
The Math Class Methods Utilizing the Important Math Operations of Java!
NR 322: Raster Analysis I Jim Graham Fall 2008 Chapter 7.
Divisibility and Mental Math. Vocabulary A number is divisible by another number if it can be divided into and result in a remainder of is divisible.
Divisibility Rules. What Are Divisibility Rules? They are a quick way to tell if one number can be completely divided into another without a remainder.
Dividing with Significant Figures. In calculations, the accuracy of the calculated result is limited by the least accurate measurement involved in the.
Useful Python CMSC 120: Visualizing Information. Scope def area(diameter): radius = diameter / 2.0 A = PI * radius ** 2 return A def circumference(diameter):
Absolute Value and Step Functions (2.4.2) November 10th, 2015.
December 9, Bell Work 2. Definition of the Greatest Integer Function 3. Work on Study Guide.
Greatest Common Factor and Least Common Multiples GCF and LCM.
Do Now:. Circumference What is circumference? Circumference is the distance around a circle.
Chapter 5 Methods F Introducing Methods F Declaring Methods F Calling Methods F Passing Parameters F Pass by Value F Overloading Methods F Method Abstraction.
CS 115 Lecture 5 Math library; building a project Taken from notes by Dr. Neil Moore.
CSE 110: Programming Language I Afroza Sultana UB 1230.
Math class Random() method Floor method Top-level parseInt function
Mathematical Functions
Divisibility and Mental Math
Divisibility and Mental Math
Divisibility Rules.
Divisibility and Mental Math
Chapter 6: User-Defined Functions I
Introduction to Value-Returning Functions: Generating Random Numbers
Every number has its place!
Php – Math functions.
Today in COMP 110 Brief static review The Math Class Wrapper Classes
Rules of Divisibility A number is said to be “divisible” by a number if you can divide it by that number and get no remainder.
16 Mathematics of Normal Distributions
Divide two Integers.
Oracle Academy Lead Adjunct
Presentation transcript:

ICS 3U Math Class

ActionScript 3 – Math Class Rounding ceil – closest integer >= number (rounds up) floor – closest integer <= number (rounds down) round – rounds to the nearest integer (follows rules of rounding)

ActionScript 3 – A Math Class Calculations max – returns the largest number in a list min – returns the smallest number in a list pow – will calculate the power of a number (specify the number and the exponent) sqrt – will calculate the squareroot of a number

ActionScript 3 – A Math Class Common Constant PI – contains the number Can use this is calculations

ActionScript 3 – A Math Class Random Numbers Random will generate a random number between 0 and 1 Need to use floor and some calculations to make the random number within a range

ActionScript 3 – A Math Class Examples newnum = Math.ceil(num); newnum = Math.floor(num); maxnum = Math.max(num1, num2, num3, num4); newnum = Math.pow(num, 4); randnum = Math.floor(Math.random() * (1 + high – low) + low); newnum = Math.round(num); numsqrt = Math.sqrt(num); circlearea = 2 * Math.PI * (radius^2);

Modulo % - A Math Operator The modulo math operator calculates the remainder of a division. Examples:  8 % 6 would equal 2 (8 divided by 6 is 1, with 2 remaining)  10 % 3 would equal 1 (10 divided by 3 is 3, with 1 remaining)  22 % 11 would equal 0 (22 divided by 11 is 2, with 0 remaining) When a modulo calculation results in 0, you know that the numbers are evenly divisible. Common uses are: –to determine if a number is even (num % 2 == 0), or –to separate the digits of a number (onesdigit = num % 10).

Programming Exercises 1.Adapt the Circle Calculation program to use PI 2.Adapt your smallest of three numbers to use min. 3.Generate a random number with 3 digits and output each digit separately. (You do not need a stage!)