Course Content. Objectives of Lecture 11 Tracing Programs and the Debugger. Outline of Lecture 11. CMPUT 102: Tracing Programs Dr. Osmar R.
|
|
- Austin Sherman
- 5 years ago
- Views:
Transcription
1 Structural Programming and Data Structures Winter 2000 CMPUT 102: Tracing Programs Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection Repetition Vectors Testing/Debugging Arrays Searching Files I/O Sorting Inheritance Recursion University of Alberta University of Alberta 1 University of Alberta 2 Objectives of Lecture 11 Tracing Programs and the Debugger Learn how to trace the execution of a Java program. Understand what is happening during the execution of a program. Use program tracing: to find errors in programs; to understand what a program is supposed to do. Introduce the debugging facilities. University of Alberta 3 Outline of Lecture 11 Example of a new program Notation for hand tracing Hand tracing The Code Warrior Debugger Tracing the example program again University of Alberta 4
2 public class Tunes { and diss a summary of the collection value. public static void (String []) { Program statements go here music.discds(); Monitors the value of a collection of musical CDs. Private instance variables private int numcds; private float valuecds; public CD_Collection (int initialnum, float initialval) { Initializes the collection with the given number of CDs and the given value of the CD collection..numcds = initialnum;.valuecds = initialval; public void add_cds(int number, float value) { Adds CDs to the collection and adjusts the total value..numcds =.numcds + number;.valuecds =.valuecds + value; public void discds() { Diss the number of CDs in the collection and the total value of the collection. System.out.print ("Total Number of CDs: "); System.out.println(.numCDs); System.out.print ("Total Value of Collection: "); System.out.println(.valueCDs); System.out.print ("Average cost per CD: $"); System.out.println(.averageCost()); private float averagecost() { Determines the average cost of a CD in the collection. float average; average =.valuecds/.numcds; return average; Outline of Lecture 11 Example of a new program Notation for hand tracing Hand tracing The Code Warrior Debugger Tracing the example program again University of Alberta 5 University of Alberta 6 Tracing Tracing is a technique that follows the execution of program in detail. Tracing can be used to understand how a Java program works. Tracing can also be used to find semantic errors in a program. A program can be hand traced by drawing diagrams. A program can also be traced using a tool called a debugger. University of Alberta 7 Notation for Hand Tracing Every method is represented by a rectangle. Every object is represented by an oval labeled by its class or its contents. Every reference is represented by a rectangle in the method that declares it. However, you can ignore public imported variables. Every reference has an arc connecting it to the object that it references. University of Alberta 8
3 Outline of Lecture 11 Example of a new program Notation for hand tracing Hand tracing The Code Warrior Debugger Tracing the example program again Trace - call Since is an application, the interpreter invokes the static method called. Since is static, there is no -. University of Alberta 9 University of Alberta 10 Trace - The parameter is a reference The variable is a reference public static void (String []) { ; = new ();.(); University of Alberta 11 Trace - - When the new object is created we draw it and when the reference is bound to the new object we connect it. public static void (String []) { ; = new ();.(); University of Alberta 12
4 Trace - call When the () message is sent to the object, we draw a rectangle for the () method that contains the reference, connect the methods and bind the reference to the receiver object. public static void ; = new ();.(); Trace - There are no method parameters, there are two variables, and. private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); University of Alberta 13 University of Alberta 14 Trace - call When () is sent to the object, we draw a () method with a new reference, connect the methods and bind the new to the receiver object. private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); University of Alberta 15 Trace - There are no method parameters, there is one variable, ername. ername private String () { String ername; System.out.println("Wel..."); System.out.print( The date is ); System.out.print(new Date()); System.out.println(); University of Alberta 16
5 Trace - output Output some information. Welcome to the Arithmetic... The date is Tue February What is your? ername private String () { String ername; System.out.println("Wel..."); System.out.print( The date is ); System.out.print(new Date()); System.out.println(); System.out.print( What is ); University of Alberta 17 Trace - input Send readstring() to the keyboard, get back a String object that represents what the user typed and bind ername to it. ername private String () { String ername; System.out.print( What is ); ername = Keyboard.in.readString(); Welcome to the Arithmetic... The date is Tue February 1... What is your?fred University of Alberta 18 Trace - pause Output some more information and ask the keyboard to pause. Wait until the user presses the ENTER key. ername private String () { String ername; System.out.println( air! ); Keyboard.in.pause(); return ername; mathematical magic in the air! Press the ENTER key to continue Trace - return Return the object bound to the variable ername as the result of the message and discard the method. ername private String () { String ername; System.out.println( air! ); Keyboard.in.pause(); return ername; return object University of Alberta 19 University of Alberta 20
6 Trace - Bind the variable to the object that was returned from the () message. private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); Trace - call enterroom When enterroom() is sent to, we draw an enterroom() method with a new reference, connect the methods and bind the new to the receiver object. enterroom private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); University of Alberta 21 University of Alberta 22 Trace - enterroom There is a method parameter called thename that is bound to the argument object and a variable, mytokens. enterroom thename mytokens private Integer enterroom( String thename){ Integer mytokens; System.out.print( How many"); System.out.print(theName); System.out.print(? ); mytokens = Keyboard.in.readInteger(); return mytokens; University of Alberta 23 Trace - enterroom input Output some information, input an Integer from the keyboard and bind mytokens to it. enterroom thename mytokens private Integer enterroom( String thename){ Integer mytokens; System.out.print( How many"); System.out.print(theName); System.out.print(? ); mytokens = Keyboard.in.readInteger(); return mytokens; University of Alberta 24
7 Trace - enterroom return Return the object bound to the variable mytokens as the result of the message and discard the method. enterroom thename mytokens private Integer enterroom( String thename){ Integer mytokens; mytokens = Keyboard.in.readInteger(); return mytokens; return object Trace - Bind the variable to the object that was returned from the enterroom() message. private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); University of Alberta 25 University of Alberta 26 Trace - call farewell When farewell() is sent to, we draw a farewell() method with a new reference, connect the methods and bind the new to the receiver object. farewell private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); Trace - farewell There are method parameters called username and tokencount that are bound to the argument objects and no variables. farewell username tokencount private void farewell( String username, Integer tokencount) { System.out.print("Congrat"); System.out.print(userName); System.out.print(" you hav"); System.out.print(tokenCount); System.out.println(" toke"); Keyboard.in.pause(); University of Alberta 27 University of Alberta 28
8 Trace - farewell output Output some information and ask the keyboard to pause. Wait until the user presses the ENTER key. private void farewell( String username, farewell username tokencount Integer tokencount) { System.out.print("Congrat"); System.out.print(userName); System.out.print(" you hav"); System.out.print(tokenCount); System.out.println(" toke"); Keyboard.in.pause(); Trace - farewell return This method does not return a result so just discard the method. farewell username tokencount private void farewell( String username, Integer tokencount) { System.out.print("Congrat"); System.out.print(userName); System.out.print(" you hav"); System.out.print(tokenCount); System.out.println(" toke"); Keyboard.in.pause(); University of Alberta 29 University of Alberta Trace - return This method does not return a result so just discard the method. private void () { String ; Integer ; =.(); =.enterroom();.farewell(, ); Trace - return The static method does not return a result so just discard the method. The program is now done. public static void ; = new ();.(); University of Alberta 31 University of Alberta 32
9 Outline of Lecture 11 Example of a new program Notation for hand tracing Hand tracing The Code Warrior Debugger Tracing the example program again Demonstration Debugger Trace Version 2 in CodeWarrior using the debugger. A demo of the debugger will be given in the lab. The Debugger will allow you to execute you Java program statement by statement, and visualize your objects and variables during runtime. University of Alberta 33 University of Alberta 34 Outline of Lecture 11 Example of a new program Notation for hand tracing Hand tracing The Code Warrior Debugger Tracing the example program again public class Tunes { and diss a summary of the collection value. public static void (String []) { Program statements go here music.discds(); Monitors the value of a collection of musical CDs. Private instance variables private int numcds; private float valuecds; public CD_Collection (int initialnum, float initialval) { Initializes the collection with the given number of CDs and the given value of the CD collection. music numcd= valuecd= numcd=5 valuecd= Constructor.numCDs = initialnum;.valuecds = initialval; University of Alberta 35 University of Alberta 36
10 public class Tunes { and diss a summary of the collection value. public static void (String []) { public class Tunes { and diss a summary of the collection value. public static void (String []) { Program statements go here music.discds(); Monitors the value of a collection of musical CDs. public void addcds(int number, float value) { Adds CDs to the collection and adjusts the total value..numcds =.numcds + number;.valuecds =.valuecds + value; 3 music addcds numcd=5 valuecd=50.00 numcd=6 valuecd=60.99 numcd=9 valuecd= addcds 1 Program statements go here music.discds(); Monitors the value of a collection of musical CDs. public void discds() { Diss the number of CDs in the collection and the total value of the collection. System.out.print ("Total Number of CDs: "); System.out.println(.numCDs); System.out.print ("Total Value of Collection: "); System.out.println(.valueCDs); System.out.print ("Average cost per CD: $"); System.out.println(.averageCost()); music averagecost numcd=9 valuecd=81.98 discd ========================= Total Number of CDs: 9 Total Value of Collection: Average cost per CD: $ University of Alberta 37 University of Alberta 38 public class Tunes { and diss a summary of the collection value. public static void (String []) { public class Tunes { and diss a summary of the collection value. public static void (String []) { Program statements go here music numcd=9 valuecd=81.98 Program statements go here music numcd=9 valuecd=81.98 music.discds(); Monitors the value of a collection of musical CDs. private float averagecost() { Determines the average cost of a CD in the collection. float average; average =.valuecds/.numcds; return average; averagecost return object / 9 = averagecost average ========================= Total Number of CDs: 9 Total Value of Collection: Average cost per CD: $ music.discds(); Monitors the value of a collection of musical CDs. public void discds() { Diss the number of CDs in the collection and the total value of the collection. System.out.print ("Total Number of CDs: "); System.out.println(.numCDs); System.out.print ("Total Value of Collection: "); System.out.println(.valueCDs); System.out.print ("Average cost per CD: $"); System.out.println(.averageCost()); ========================= Total Number of CDs: 9 Total Value of Collection: Average cost per CD: $ University of Alberta 39 University of Alberta 40
Course Content. Objectives of Lecture 24 Inheritance. Outline of Lecture 24. CMPUT 102: Inheritance Dr. Osmar R. Zaïane. University of Alberta 4
Structural Programming and Data Structures Winter 2000 CMPUT 102: Inheritance Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection Repetition
More informationCourse Content. Objectives of Lecture 20 Arrays. Outline of Lecture 20. CMPUT 102: Arrays Dr. Osmar R. Zaïane. University of Alberta 4
Structural Programming and Data Structures Winter CMPUT 1: Arrays Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection Repetition Vectors
More informationCourse Content. Objectives of Lecture 24 Inheritance. Outline of Lecture 24. Inheritance Hierarchy. The Idea Behind Inheritance
Structural Programming and Data Structures Winter 2000 CMPUT 102: Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection Repetition Vectors
More informationCourse Content. Objectives of Lecture 22 File Input/Output. Outline of Lecture 22. CMPUT 102: File Input/Output Dr. Osmar R.
Structural Programming and Data Structures Winter 2000 CMPUT 102: Input/Output Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection
More informationCourse Content. Objectives of Lecture 13 Common Resources Static Variables and Methods. Outline of Lecture 13
Structural Programming and Data Structures Winter 2000 CMPUT 102: Sharing Resources Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection
More informationCourse Content. Objectives of Lecture 18 Black box testing and planned debugging. Outline of Lecture 18
Structural Programming and Data Structures Winter 2000 CMPUT 102: Testing and Debugging Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources Selection
More informationCourse Content. Objectives of Lecture 17 Vectors and For Statements. Outline of Lecture 17. Containers. Strings and Stacks
Structural Programming and Data Structures Winter 2000 CMPUT 102: Vectors and other Repetitions Dr. Osmar R. Zaïane Course Content Introduction Objects Methods Tracing Programs Object State Sharing resources
More informationAbout This Lecture. Repetition Control Structures - while. Outline. Repetition
2 About This Lecture Repetition Control Structures - while Cmput 114 - Lecture 16 Department of Computing Science University of Alberta z So far our programs execute each statement exactly once or zero
More informationSection 2.2 Your First Program in Java: Printing a Line of Text
Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationIntroduction Welcome! Before you start Course Assessments The course at a glance How to pass M257
Introduction Unit 1: Java Everywhere Prepared by: Dr. Abdallah Mohamed, AOU-KW 1 Introduction Welcome! Before you start Course Assessments The course at a glance How to pass M257 1. Java background 2.
More informationOperational Semantics. One-Slide Summary. Lecture Outline
Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:
More informationTeenCoder : Java Programming (ISBN )
TeenCoder : Java Programming (ISBN 978-0-9887070-2-3) and the AP * Computer Science A Exam Requirements (Alignment to Tennessee AP CS A course code 3635) Updated March, 2015 Contains the new 2014-2015+
More informationAL GHURAIR UNIVERSITY College of Computing. Objectives: Examples: Text-printing program. CSC 209 JAVA I
AL GHURAIR UNIVERSITY College of Computing CSC 209 JAVA I week 2- Arithmetic and Decision Making: Equality and Relational Operators Objectives: To use arithmetic operators. The precedence of arithmetic
More informationCompuScholar, Inc. 9th - 12th grades
CompuScholar, Inc. Alignment to the College Board AP Computer Science A Standards 9th - 12th grades AP Course Details: Course Title: Grade Level: Standards Link: AP Computer Science A 9th - 12th grades
More information7.3 Arrays of Strings (Objects) 7.3 Arrays of Strings (Objects) 7.3 Tunes.java. 7.3 Arrays of Objects 9/11/13. ! A UML diagram for the Tunes program
7.3 Arrays of Strings (Objects)! The elements of an array can be object references! The following declara6on reserves space to store 5 references to String objects String[] words = new String[5];! Ini6ally
More informationObject Orientated Analysis and Design. Benjamin Kenwright
Notation Part 2 Object Orientated Analysis and Design Benjamin Kenwright Outline Review What do we mean by Notation and UML? Types of UML View Continue UML Diagram Types Conclusion and Discussion Summary
More informationIMACS: AP Computer Science A
IMACS: AP Computer Science A OVERVIEW This course is a 34-week, 4 classroom hours per week course for students taking the College Board s Advanced Placement Computer Science A exam. It is an online course
More informationBinary Search. Roland Backhouse February 5th, 2001
1 Binary Search Roland Backhouse February 5th, 2001 Outline 2 An implementation in Java of the card-searching algorithm is presented. Issues concerning the correctness of the implementation are raised
More informationArrays. Outline 1/7/2011. Arrays. Arrays are objects that help us organize large amounts of information. Chapter 7 focuses on:
Arrays Arrays Arrays are objects that help us organize large amounts of information Chapter 7 focuses on: array declaration and use bounds checking and capacity arrays that store object references variable
More informationFull file at
Chapter 2 Introduction to Java Applications Section 2.1 Introduction ( none ) Section 2.2 First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler
More informationLecture 5: Methods CS2301
Lecture 5: Methods NADA ALZAHRANI CS2301 1 Opening Problem Find the sum of integers from 1 to 10, from 20 to 30, and from 35 to 45, respectively. 2 Solution public static int sum(int i1, int i2) { int
More informationObject Oriented Programming. Java-Lecture 1
Object Oriented Programming Java-Lecture 1 Standard output System.out is known as the standard output object Methods to display text onto the standard output System.out.print prints text onto the screen
More informationCSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall Office hours:
CSE115 / CSE503 Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall alphonce@buffalo.edu Office hours: Tuesday 10:00 AM 12:00 PM * Wednesday 4:00 PM 5:00 PM Friday 11:00 AM 12:00 PM OR
More informationJava Software Solutions for AP Computer Science 3rd Edition, Lewis et al. 2011
A Correlation of AP Computer Science 3rd Edition, Lewis et al. 2011 To the INTRODUCTION This document demonstrates how AP (Advanced Placement) Computer Science, 3rd Edition 2011, Lewis et al. meets the
More informationSection 2.2 Your First Program in Java: Printing a Line of Text
Chapter 2 Introduction to Java Applications Section 2.2 Your First Program in Java: Printing a Line of Text 2.2 Q1: End-of-line comments that should be ignored by the compiler are denoted using a. Two
More informationCMPUT 201: Practical Programming Methodology. Guohui Lin Department of Computing Science University of Alberta September 2018
CMPUT 201: Practical Programming Methodology Guohui Lin guohui@ualberta.ca Department of Computing Science University of Alberta September 2018 Lecture 1: Course Outline Agenda: Course calendar description
More informationCS 177 Week 15 Recitation Slides. Review
CS 177 Week 15 Recitation Slides Review 1 Announcements Final Exam on Friday Dec. 18 th STEW 183 from 1 3 PM Complete your online review of your classes. Your opinion matters!!! Project 6 due Just kidding
More informationWelcome1.java // Fig. 2.1: Welcome1.java // Text-printing program.
1 Welcome1.java // Fig. 2.1: Welcome1.java // Text-printing program. public class Welcome1 // main method begins execution of Java application System.out.println( "Welcome to Java Programming!" ); } //
More informationClass and Office Hours. Course Requirements. CMPUT 102: Introduction. Winter Class: Mondays, Wednesdays and Fridays from 14:00 to 14:50
Structural Programming and Data Structures Class and Office Hours Winter 000 CMPUT 0: Introduction Dr. Osmar R. Zaïane Class: Mondays, Wednesdays and Fridays from 4:00 to 4:50 Office Hours: Tuesdays and
More informationCIS 110: Introduction to Computer Programming
CIS 110: Introduction to Computer Programming Lecture 5 The Loop-the-Loop ( 2.3-2.4) 9/21/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline 1. For-loops! 2. Algorithm Design and Pseudocode 9/21/2011
More informationINDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line
A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type
More informationAbout This Lecture. Selection Control Structures - if. Sequence. Outline. Selection
2 About This Lecture Selection Control Structures - if Cmput 114 - Lecture 14 Department of Computing Science University of Alberta z Each of our programs consists of a sequence of statements. z Even though
More informationMore About Objects and Methods
More About Objects and Methods Chapter 6 Objectives Define and use constructors Write and use static variables and methods Use methods from class Math Use predefined wrapper classes Use stubs, drivers
More information7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING
KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve
More informationLecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far
Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify
More informationChapter 5 Control Statements: Part 2 Section 5.2 Essentials of Counter-Controlled Repetition
Chapter 5 Control Statements: Part 2 Section 5.2 Essentials of Counter-Controlled Repetition 5.2 Q1: Counter-controlled repetition requires a. A control variable and initial value. b. A control variable
More informationM.CS201 Programming language
Power Engineering School M.CS201 Programming language Lecture 4 Lecturer: Prof. Dr. T.Uranchimeg Agenda How a Function Works Function Prototype Structured Programming Local Variables Return value 2 Function
More informationArray Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)
Array Basics: Outline Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and Constants
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationNested Loops. A loop can be nested inside another loop.
Nested Loops A loop can be nested inside another loop. Nested loops consist of an outer loop and one or more inner loops. Each time the outer loop is repeated, the inner loops are reentered, and started
More informationChapter 4 Loops. Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved.
Chapter 4 Loops 1 Motivations Suppose that you need to print a string (e.g., "Welcome to Java!") a hundred times. It would be tedious to have to write the following statement a hundred times: So, how do
More informationBLM2031 Structured Programming. Zeyneb KURT
BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help
More informationEveryday Activity. Course Content. Objectives of Lecture 13 Search Engine
Web Technologies and Applications Winter 2001 CMPUT 499: Search Engines Dr. Osmar R. Zaïane University of Alberta Everyday Activity We use search engines whenever we look for resources on the Internet
More informationLecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.
Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationObject-Oriented Programming and Software Engineering CITS1001 MID-SEMESTER TEST
Object-Oriented Programming and Software Engineering School of Computer Science & Software Engineering The University of Western Australia CITS1001 MID-SEMESTER TEST Semester 1, 2013 CITS1001 This Paper
More informationObjectives. Order (sort) the elements of an array Search an array for a particular item Define, use multidimensional array
Arrays Chapter 7 Objectives Nature and purpose of an array Using arrays in Java programs Methods with array parameter Methods that return an array Array as an instance variable Use an array not filled
More informationFaculty of Engineering Computer Engineering Department Islamic University of Gaza C++ Programming Language Lab # 6 Functions
Faculty of Engineering Computer Engineering Department Islamic University of Gaza 2013 C++ Programming Language Lab # 6 Functions C++ Programming Language Lab # 6 Functions Objective: To be familiar with
More informationNOTE: Answer ANY FOUR of the following 6 sections:
A-PDF MERGER DEMO Philadelphia University Lecturer: Dr. Nadia Y. Yousif Coordinator: Dr. Nadia Y. Yousif Internal Examiner: Dr. Raad Fadhel Examination Paper... Programming Languages Paradigms (750321)
More informationComputer Science is...
Computer Science is... Automated Software Verification Using mathematical logic, computer scientists try to design tools to automatically detect runtime and logical errors in huge, complex programs. Right:
More informationIntroduction to Classes and Objects Pearson Education, Inc. All rights reserved.
1 3 Introduction to Classes and Objects 2 You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.
More informationCOMP 250. Lecture 32. polymorphism. Nov. 25, 2016
COMP 250 Lecture 32 polymorphism Nov. 25, 2016 1 Recall example from lecture 30 class String serialnumber Person owner void bark() {print woof } : my = new (); my.bark();?????? extends extends class void
More informationConstants. Why Use Constants? main Method Arguments. CS256 Computer Science I Kevin Sahr, PhD. Lecture 25: Miscellaneous
CS256 Computer Science I Kevin Sahr, PhD Lecture 25: Miscellaneous 1 main Method Arguments recall the method header of the main method note the argument list public static void main (String [] args) we
More informationMirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006
Mirage Language Reference Manual Image drawn using Mirage 1.1 Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Prof. Stephen Edwards Team Members: Abhilash I ai2160@columbia.edu
More informationOutline. CIS 110: Introduction to Computer Programming. Announcements. For Loops. Redundancy in Patterns. A Solution with Our Current Tools
Outline CIS 110: Introduction to Computer Programming 1. For-loops! 2. Algorithm Design and Pseudocode Lecture 5 The Loop-the-Loop ( 2.3-2.4) 1 2 Announcements Date of the final is tentatively: MONDAY,
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A
More informationGetting started with Java
Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving
More informationCS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style
CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming
More informationIntroduction to Classes and Objects Pearson Education, Inc. All rights reserved.
1 3 Introduction to Classes and Objects 2 You will see something new. Two things. And I call them Thing One and Thing Two. Dr. Theodor Seuss Geisel Nothing can have value without being an object of utility.
More informationCollege Board. AP CS A Labs Magpie, Elevens, and Picture Lab. New York: College Entrance Examination Board, 2013.
AP Computer Science August 2014 June 2015 Class Description AP Computer Science is the second class after Pre-AP Computer Science that together teach the fundamentals of object-oriented programming and
More informationProgramming with Java
Programming with Java Data Types & Input Statement Lecture 04 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives q By the end of this lecture you should be able to : ü Know rules
More informationCS 101 Fall 2006 Midterm 3 Name: ID:
You only need to write your name and e-mail ID on the first page. This exam is CLOSED text book, closed-notes, closed-calculator, closed-neighbor, etc. Questions are worth different amounts, so be sure
More informationAbout This Lecture. Data Abstraction - Interfaces and Implementations. Outline. Object Concepts. Object Class, Protocol and State.
Revised 01/09/05 About This Lecture Slide # 2 Data Abstraction - Interfaces and Implementations In this lecture we will learn how Java objects and classes can be used to build abstract data types. CMPUT
More informationCS 110 Practice Final Exam originally from Winter, Instructions: closed books, closed notes, open minds, 3 hour time limit.
Name CS 110 Practice Final Exam originally from Winter, 2003 Instructions: closed books, closed notes, open minds, 3 hour time limit. There are 4 sections for a total of 49 points. Part I: Basic Concepts,
More informationSimple Java Programming Constructs 4
Simple Java Programming Constructs 4 Course Map In this module you will learn the basic Java programming constructs, the if and while statements. Introduction Computer Principles and Components Software
More informationCIS 110: Introduction to Computer Programming
CIS 110: Introduction to Computer Programming Lecture 3 Express Yourself ( 2.1) 9/16/2011 CIS 110 (11fa) - University of Pennsylvania 1 Outline 1. Data representation and types 2. Expressions 9/16/2011
More informationLoops. CSE 114, Computer Science 1 Stony Brook University
Loops CSE 114, Computer Science 1 Stony Brook University http://www.cs.stonybrook.edu/~cse114 1 Motivation Suppose that you need to print a string (e.g., "Welcome to Java!") a user-defined times N: N?
More informationComputer Programming, I. Laboratory Manual. Final Exam Solution
Think Twice Code Once The Islamic University of Gaza Engineering Faculty Department of Computer Engineering Fall 2017 ECOM 2005 Khaleel I. Shaheen Computer Programming, I Laboratory Manual Final Exam Solution
More informationProgramming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan
Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with
More informationGive one example where you might wish to use a three dimensional array
CS 110: INTRODUCTION TO COMPUTER SCIENCE SAMPLE TEST 3 TIME ALLOWED: 60 MINUTES Student s Name: MAXIMUM MARK 100 NOTE: Unless otherwise stated, the questions are with reference to the Java Programming
More informationSri Vidya College of Engineering & Technology
UNIT I INTRODUCTION TO OOP AND FUNDAMENTALS OF JAVA 1. Define OOP. Part A Object-Oriented Programming (OOP) is a methodology or paradigm to design a program using classes and objects. It simplifies the
More informationExam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming
Exam 1 Prep Dr. Demetrios Glinos University of Central Florida COP3330 Object Oriented Programming Progress Exam 1 is a Timed Webcourses Quiz You can find it from the "Assignments" link on Webcourses choose
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 15 Class Relationships Outline Problem: How can I create and store complex objects? Review of static methods Consider static variables What about objects
More informationTOPIC 2 INTRODUCTION TO JAVA AND DR JAVA
1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationCS171:Introduction to Computer Science II
CS171:Introduction to Computer Science II Department of Mathematics and Computer Science Li Xiong 1/24/2012 1 Roadmap Lab session Pretest Postmortem Java Review Types, variables, assignments, expressions
More information1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003
1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to
More informationObject-Oriented Concepts
JAC444 - Lecture 3 Object-Oriented Concepts Segment 2 Inheritance 1 Classes Segment 2 Inheritance In this segment you will be learning about: Inheritance Overriding Final Methods and Classes Implementing
More informationStatic Semantics. Lecture 15. (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1
Static Semantics Lecture 15 (Notes by P. N. Hilfinger and R. Bodik) 2/29/08 Prof. Hilfinger, CS164 Lecture 15 1 Current Status Lexical analysis Produces tokens Detects & eliminates illegal tokens Parsing
More informationCI228 CI228 Tutorials
CI228 M A Smith University of Brighton September 13, 2016 Page 1 BIO - Basic Input Output Input of an integer number The static method BIO.getInt() will read from the keyboard an integer number typed by
More informationCONDITIONAL EXECUTION
CONDITIONAL EXECUTION yes x > y? no max = x; max = y; logical AND logical OR logical NOT &&! Fundamentals of Computer Science I Outline Conditional Execution if then if then Nested if then statements Comparisons
More informationLecture 9. Assignment. Logical Operations. Logical Operations - Motivation 2/8/18
Assignment Lecture 9 Logical Operations Formatted Print Printf Increment and decrement Read through 3.9, 3.10 Read 4.1. 4.2, 4.3 Go through checkpoint exercise 4.1 Logical Operations - Motivation Logical
More informationRecursion. Chapter 11
Walter Savitch Frank M. Carrano Recursion Chapter 11 ISBN 0136091113 2009 Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved Objectives Describe the concept of recursion Use recursion
More informationChapter 3 Syntax, Errors, and Debugging. Fundamentals of Java
Chapter 3 Syntax, Errors, and Debugging Objectives Construct and use numeric and string literals. Name and use variables and constants. Create arithmetic expressions. Understand the precedence of different
More informationLaboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information
Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify
More informationThe Java programming environment. The Java programming environment. Java: A tiny intro. Java features
The Java programming environment Cleaned up version of C++: no header files, macros, pointers and references, unions, structures, operator overloading, virtual base classes, templates, etc. Object-orientation:
More information1.00 Lecture 13. Inheritance
1.00 Lecture 13 Inheritance Reading for next time: Big Java: sections 10.5-10.6 Inheritance Inheritance allows you to write new classes based on existing (super or base) classes Inherit super class methods
More informationBoca Raton Community High School AP Computer Science A - Syllabus 2009/10
Boca Raton Community High School AP Computer Science A - Syllabus 2009/10 Instructor: Ronald C. Persin Course Resources Java Software Solutions for AP Computer Science, A. J. Lewis, W. Loftus, and C. Cocking,
More informationThe Java language has a wide variety of modifiers, including the following:
PART 5 5. Modifier Types The Java language has a wide variety of modifiers, including the following: Java Access Modifiers Non Access Modifiers 5.1 Access Control Modifiers Java provides a number of access
More informationMaterial Java type system Reflection
CS1706 Intro to Object Oriented Dev II -Fall 04 Announcements Week 15 Final Exam: Tues. Dec. 14 @ 3:25pm Material Java type system Reflection Java Type System Type System is a set of values and the operations
More informationCSCI 2212: Intermediate Programming / C Review, Chapters 10 and 11
... 1/16 CSCI 2212: Intermediate Programming / C Review, Chapters 10 and 11 Alice E. Fischer February 3, 2016 ... 2/16 Outline Basic Types and Diagrams ... 3/16 Basic Types and Diagrams Types in C C has
More information3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.
3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.
More informationIntro to Programming in Java Practice Midterm
600.107 Intro to Programming in Java Practice Midterm This test is closed book/notes. SHORT ANSWER SECTION [18 points total] 1) TRUE/FALSE - Please circle your choice: Tr for true, Fa for false. [1 point
More informationReview. Primitive Data Types & Variables. String Mathematical operators: + - * / % Comparison: < > <= >= == int, long float, double boolean char
Review Primitive Data Types & Variables int, long float, double boolean char String Mathematical operators: + - * / % Comparison: < > = == 1 1.3 Conditionals and Loops Introduction to Programming in
More informationAlgorithms & Data Structures
GATE- 2016-17 Postal Correspondence 1 Algorithms & Data Structures Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key
More informationQ1 Q2 Q3 Q4 Q5 Total 1 * 7 1 * 5 20 * * Final marks Marks First Question
Page 1 of 6 Template no.: A Course Name: Computer Programming1 Course ID: Exam Duration: 2 Hours Exam Time: Exam Date: Final Exam 1'st Semester Student no. in the list: Exam pages: Student's Name: Student
More informationAP Computer Science AB
AP Computer Science AB Dr. Tyler Krebs Voice Mail: 431-8938 Classroom: B128 Office: TV Studio Characteristics We Value in This Classroom: 1. Respect. (Show respect for everyone and everything.) 2. Integrity.
More informationA Fast Review of C Essentials Part I
A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 13 Two Dimensional Arrays Outline Problem: How do store and manipulate data in tabular format Two-dimensional arrays easy access with 2 indices This
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 13 Two Dimensional Arrays Outline Problem: How do store and manipulate data in tabular format Two-dimensional arrays easy access with 2 indices This
More information