THINKING BIG Abstraction and Functions chapter 6 Modified by Dr. Paul Mullins for CPSC 130, F05.

Slides:



Advertisements
Similar presentations
Copyright © 2003 Pearson Education, Inc. Slide 1.
Advertisements

Copyright © 2002 Pearson Education, Inc. Slide 1.
Copyright © 2014 Pearson Addison-Wesley. All rights reserved. Chapter 17 Templates.
Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 7 - JavaScript: Introduction to Scripting Outline 7.1 Introduction 7.2 Simple Program: Printing.
Chapter 19 Programming Functions. Copyright © 2013 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Learning Objectives Apply JavaScript rules.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Slide 4- 1 ; Programmer-Defined Functions Two components of a function definition.
Copyright © 2008 Pearson Education, Inc. Chapter R Algebra Reference Copyright © 2008 Pearson Education, Inc.
Copyright © 2008 Pearson Education, Inc. Chapter 10 Differential Equations Copyright © 2008 Pearson Education, Inc.
Copyright © 2008 Pearson Education, Inc. Chapter 1 Linear Functions Copyright © 2008 Pearson Education, Inc.
Copyright © 2008 Pearson Education, Inc. Chapter 11 Probability and Calculus Copyright © 2008 Pearson Education, Inc.
Chapter 20 Thinking Big: Functions. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Anatomy of a Function Functions are packages for.
Copyright © 2008 Pearson Education, Inc. Chapter 3 The Derivative Copyright © 2008 Pearson Education, Inc.
Copyright © 2008 Pearson Education, Inc. Chapter 4 Calculating the Derivative Copyright © 2008 Pearson Education, Inc.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
Copyright © 2008 Pearson Education, Inc. Chapter 13 The Trigonometric Functions Copyright © 2008 Pearson Education, Inc.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 4 Image Slides.
XP Tutorial 1 New Perspectives on JavaScript, Comprehensive1 Introducing JavaScript Hiding Addresses from Spammers.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Programming Functions Thinking Big lawrence snyder c h a p t e r 20.
Introduction to JavaScript for Python Programmers
© 2007 Lawrenceville Press Slide 1 Chapter 7 Top-Down Development  Problem-solving approach  Breaking a task down into smaller subtasks  First level.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 10 - JavaScript: Functions Outline 10.1 Introduction 10.2 Program Modules in JavaScript 10.3.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
1 Functions Lecfture Abstraction abstraction is the process of ignoring minutiae and focusing on the big picture in modern life, we are constantly.
Computers and Scientific Thinking David Reed, Creighton University Functions and Libraries 1.
Slide 6-1 Copyright © 2004 Pearson Education, Inc.
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
An Object-Oriented Approach to Programming Logic and Design Fourth Edition Chapter 6 Using Methods.
JavaScript III Functions and Abstraction. 2 JavaScript so far statements assignment function calls data types numeric string boolean expressions variables.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Copyright © 2014, 2010, and 2006 Pearson Education, Inc. Chapter 4 Polynomials.
Chapter 2: Variables, Functions, Objects, and Events JavaScript - Introductory.
Internet & World Wide Web How to Program, 5/e. © by Pearson Education, Inc. All Rights Reserved.2 Revised by Dr. T. Tran for CSI3140.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 5.3Math Library Functions Math library functions –perform.
Structure Programming Lecture 8 Chapter 5&6 - Function – part I 12 December 2015.
JavaScript, Fourth Edition
Chapter 10: JavaScript Functions CIS 275—Web Application Development for Business I.
JavaScript: The First Parts Part One Douglas Crockford Yahoo! Inc.
1 JavaScript Part 3. Functions Allow the user to decide when a particular script should be run by the browser in stead of running as long as the page.
Part:2.  Keywords are words with special meaning in JavaScript  Keyword var ◦ Used to declare the names of variables ◦ A variable is a location in the.
Functions Function is a standalone block of statements that performs some tasks and returns a value. Functions must be declared before they can be used.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Copyright © 2014, 2010, and 2006 Pearson Education, Inc. Chapter 4 Polynomials.
PHP (cont.). 2 Functions Definition – function name(arguments){... } –syntax name as for a variable, but without $ arguments as for variables –to return.
Chapter 2 Opener © 2014 Pearson Education, Inc.. Figure 2.1 © 2014 Pearson Education, Inc.
JavaScript 101 Lesson 6: Introduction to Functions.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
JavaScript Variables. Definition A variable is a "container" for information you want to store. A variable's value can change during the script.
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
Chapter 5 JavaScript and HTML Documents. Copyright © 2006 Pearson Addison-Wesley. All rights reserved. 5-2 FIGURE 5.1 The DOM structure for a simple document.
Abstraction and Functions
JAVA Script : Functions Ashima Wadhwa
Chapter 7 Top-Down Development
Chapter 4 Opener © 2014 Pearson Education, Inc..
Chapter 11 Opener © 2014 Pearson Education, Inc..
4. Javascript Pemrograman Web I Program Studi Teknik Informatika
Learning Objectives Apply JavaScript rules for functions, declarations, return values, function calls, scope of reference, and local/global variable reference.
JavaScript Functions B. Ramamurthy 11/22/2018.
Functions, Procedures, and Abstraction
Chapter 7 MATH 1325 Business Calculus Ch.7 Copyright © 2005 Pearson Education, Inc.
Chapter 3 MATH 1325 Business Calculus Ch.3 Copyright © 2005 Pearson Education, Inc.
Chapter 5 MATH 1325 Business Calculus Ch.5 Copyright © 2005 Pearson Education, Inc.
Chapter 20: Programming Functions
Web Programming and Design
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

THINKING BIG Abstraction and Functions chapter 6 Modified by Dr. Paul Mullins for CPSC 130, F05

Copyright © 2003 Pearson Education, Inc. Slide 20-2 ABSTRACTION > Functions for reuse, readability, … > Unique Names — buttons on calculator > Encapsulation — how does it calculate a square root? > Parameterization — enter value, press function button → answer displayed √

Copyright © 2003 Pearson Education, Inc. Slide 20-3 CREATING A JS FUNCTION function average (num1, num2) { // Javascript statements var local = (num1 + num2) / 2; return local; } statements executed when this function is called Unique identifier Parameters: Placeholders for information to be sent to the function Variable created just for this function call Value that will replace the function call

Copyright © 2003 Pearson Education, Inc. Slide 20-4 Figure An HTML page showing the use of the convertC2F() JavaScript function to find the Fahrenheit equivalent of 38°C.

Copyright © 2003 Pearson Education, Inc. Slide 20-5 APPLYING FUNCTIONS > The HTML Page to Host JavaScript > How the convertC2F() Function Runs > The document.write() Function > Applying convertC2F() > Applying convertC2F() Again > Reusing Functions

Copyright © 2003 Pearson Education, Inc. Slide 20-6 Figure An HTML source file containing a JavaScript document.write(), and the HTML text used by the browser to create the page.

Copyright © 2003 Pearson Education, Inc. Slide 20-7 Figure The HTML and JavaScript to display a list of equivalent temperatures.

Copyright © 2003 Pearson Education, Inc. Slide 20-8 Figure 20.3 (continued). The HTML and JavaScript to display a list of equivalent temperatures.

Copyright © 2003 Pearson Education, Inc. Slide 20-9 Figure HTML and JavaScript to produce a table of equivalents.

Copyright © 2003 Pearson Education, Inc. Slide Figure 20.4 (continued). HTML and JavaScript to produce a table of equivalents.

Copyright © 2003 Pearson Education, Inc. Slide JAVASCRIPT RULES FOR FUNCTIONS > Function Declarations: function name ( params ) > Selecting Function Names – meaningful > Parameters – comma separated list of palceholders > Return Values – replace the call in an expression > Scope of Reference – { } > Local Variables – exist only in function, reinitialized > Global Variables – exist “everywhere”, retain value > Multiple Parameters – matched by position in list > Calling Functions – use name() where you want the action or value > Arguments – values to replace params for this call