Fundamentals of Software Development 1Slide 1 Methods: Defining, Invoking, Executing “There is a difference between knowing the path and walking the path.”

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming Lecture 4 Writing Java Applications, Java Development Tools.
Advertisements

LAB 3 NS2 Preliminaries. Contents TCL/OTCl Fundamentals Creating Network Setting Connections Generating Traffic Inserting Errors Configuring for multicast.
Fundamentals of Software Development 1Slide 1 Recap: Constructors, the new operator and the this object Three ideas:Three ideas: –How to write a constructor.
Overview Discrete Mathematics for Testers Set Theory Functions
Introduction to C++ Functions Chapter 6 Sections 6.1 – 6.3 Computer II.
Constructors & An Introduction to Methods. Defining Constructor – Car Example Public class car { String Model; double speed; String colour; { Public Car.
The Java Programming Language  Simple – but abstract  Safe  Platform-independent ("write once, run anywhere")  Has a Rich growing library  Designed.
Fundamentals of Software Development 1Slide 1 Today’s Summary UML class diagrams – –Why classes are important – –UML class diagrams – relationships – –UML.
Fundamentals of Software Development 1Slide 1 One class can describe many different instancesOne class can describe many different instances –Two NameDroppers,
CHAPTER 2 OBJECTS AND CLASSES Goals: To understand the concepts of classes and objects To realize the difference between objects and object references.
Datalogi A 2: 15/9. Java Slides based on Horstmann chapter 2&3 Objects and classes Import, methods, references Implementing a class.
Fundamentals of Software Development 1Slide 1 Method invocation versus definition To define (write) a method means to write its codeTo define (write) a.
Fundamentals of Software Development 1Slide 1 Methods: Defining, Invoking, Executing “There is a difference between knowing the path and walking the path.”
Object-oriented analysis (OOA) techniques are used to (1) study existing objects to see if they can be reused or adapted for new uses, and (2) define new.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 3 Programming.
Inline Function. 2 Expanded in a line when it is invoked Ie compiler replace the function call with function code To make a function inline the function.
Dale Roberts Object Oriented Programming using Java - Class Constructors Dale Roberts, Lecturer Computer Science, IUPUI Department.
CS190/295 Programming in Python for Life Sciences: Lecture 1 Instructor: Xiaohui Xie University of California, Irvine.
Factorial Calculator and Debug Mode Slides: tures/Eclipse.pdf
Introduction to Object-Oriented Programming
Macros. There are three basic phases for C programming. preprocessing, compiling, and linking. C input file is first passed to a preprocessing program.
Programming With C.
Four Fundamental Pieces Instruction Control Structure Function Expression.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
CS221 Algorithm Basics. What is an algorithm? An algorithm is a list of instructions that transform input information into a desired output. Each instruction.
Software Engineering Review CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and Computer Science.
Introduction to Computer Programming
Introducing Python CS 4320, SPRING Lexical Structure Two aspects of Python syntax may be challenging to Java programmers Indenting ◦Indenting is.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
1 Functions, Part 1 of 2 Topics Using Predefined Functions Programmer-Defined Functions Using Input Parameters Function Header Comments.
The Robot and the Wall Introduction to Pseudocode Your Name Goes Here.
1 Predefined Classes and Objects Chapter 3. 2 Objectives You will be able to:  Use predefined classes available in the Java System Library in your own.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
Functions Dilshad M. Shahid New York
Chapter 3 Implementing Classes
Computer Programming II Lecture 4. Functions - In C++ we use modules to divide the program into smaller and manageable code. These modules are called.
Tarik Booker CS 242. What we will cover…  Functions  Function Syntax  Local Variables  Global Variables  The Scope of Variables  Making Functions.
Control Structure  What is control Structure?  Types of Controls  Use the control structure in VBScript.  Example Summery.
Return to Home! Go To Next Slide! Return to Home! Go To Next Slide!
Software Engineering Algorithms, Compilers, & Lifecycle.
Introduction to Classes and Objects CS-2303, C-Term C++ Program Structure Typical C++ Programs consist of:– main –A function main –One or more classes.
Python Programming Module 1 Computers and Programs Python Programming, 2/e1.
Fundamentals of Software Development 1Slide 1 Today’s Summary InterfacesInterfaces –What are they? –Why are they important? –How do they relate to WordGames?
Java Methods and Applications CSIS 3701: Advanced Object Oriented Programming.
Hello Educational presentation.
Recap: The design of Word Games
CS 330 Class 7 Comments on Exam Programming plan for today:
continued on next slide
Programming Fundamentals Lecture #7 Functions
PHP Functions, Scope MIS 3501, Fall 2015 Jeremy Shafer
CS190/295 Programming in Python for Life Sciences: Lecture 1
                                                                                                                                                                                                                                                
continued on next slide
continued on next slide
د.سالم بني عطا استراتيجيات التدريس Teaching Strategies
First Python Program Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming: An.
المدخل إلى تكنولوجيا التعليم في ضوء الاتجاهات الحديثة
HELLO THERE. THIS IS A TEST SLIDE SLIDE NUMBER 1.
Wednesday 09/23/13.
Your first C and C++ programs
Notes about Homework #4 Professor Hugh C. Lauer CS-1004 — Introduction to Programming for Non-Majors (Slides include materials from Python Programming:
METHODS, CLASSES, AND OBJECTS A FIRST LOOK
Cell Simulation Pick and Place Routine.
Understand the interaction between computer hardware and software
AN INTRODUCTION TO OBJECTS AND CLASSES
CSE 231 Lab 3.
Glide slide 2 slide 4 walk walk run run run run.
continued on next slide
 A function is a named sequence of statement(s) that performs a computation. It contains  line of code(s) that are executed sequentially from top.
continued on next slide
Presentation transcript:

Fundamentals of Software Development 1Slide 1 Methods: Defining, Invoking, Executing “There is a difference between knowing the path and walking the path.” ~ Morpheus“There is a difference between knowing the path and walking the path.” ~ Morpheus “There is a difference between defining a method and invoking a method.” ~ CS Prof.“There is a difference between defining a method and invoking a method.” ~ CS Prof.

Fundamentals of Software Development 1Slide 2 Methods Defining, Invoking, Executing Defining a MethodDefining a Method –Specifying stepwise directions for a method… For example you specify how a robot can pick up a soda can (think of this as “teaching”)you specify how a robot can pick up a soda can (think of this as “teaching”) Invoking a MethodInvoking a Method –Asking to activate a method… For example you ask the robot to pick up a soda canyou ask the robot to pick up a soda can Executing a MethodExecuting a Method –Processing the stepwise instructions specified in the method… For example the robot carries out your command to pick up the soda canthe robot carries out your command to pick up the soda can

Fundamentals of Software Development 1Slide 3 Defining a Method Questions? Syntax for a method definition: Example of a method definition: ReturnType methodName(ParameterType parameterName,...) { // Stepwise instructions } String transform(String inputString) { return  Caps:  + inputString.toUpperCase(); }

Fundamentals of Software Development 1Slide 4 Invoking and Executing a Method Format: object.method(arguments)Format: object.method(arguments) Invoke a String method:Invoke a String method: "Hello".toUpperCase() yields "HELLO" "Hello".toUpperCase() yields "HELLO" –"Hello".substring(3) yields "lo" –"Hello".substring(1, 3) yields "el" –"Hello".substring(0) yields "Hello“ Stringmethoddotarguments, in parentheses Numbering starts at zero Questions?