Last Time: Objects and Abstraction. If it walks like a circle, swims like a circle, and quacks like a circle...!

Size: px
Start display at page:

Download "Last Time: Objects and Abstraction. If it walks like a circle, swims like a circle, and quacks like a circle...!"

Transcription

1 Pointers

2 Last Time: Objects and Abstraction If it walks like a circle, swims like a circle, and quacks like a circle...!

3 Bird s Eye View of Object-Oriented Programming Object: Collection of variables seen as a whole (noun) Field: A property of the object (adjective) Method: An essential action of the object (verb).

4 Last Time: Rectangle and Circle Structs type Rectangle struct { x1 float64 y1 float64 width float64 height float64 type Circle struct { x1 float64 y1 float64 radius float64

5 Last Time: Methods Methods allow us to have multiple functions with the same name. func (R Rectangle) Area() float64 { return R.width*R.length func (C Circle) Area() float64 { return C.radius * C.radius * math.pi

6 Last Time: Rectangle and Circle Structs type Rectangle struct { x1 float64 y1 float64 width float64 height float64 type Circle struct { x1 float64 y1 float64 radius float64 Exercise: Write Translate() methods that shift circle and rectangle by a in the x-direction and b in the y-direction.

7 Translating Points func (R Rectangle) Translate(a, b float64) { R.x1 += a R.y1 += b func (C Circle) Translate(a, b float64) { C.x1 += a C.y1 += b

8 Translating Points func main() { var R Rectangle R.x1 = 1.0 R.y1 = 3.0 R.width = 3 R.height = 5 R.Translate(-2.1, 4.7) fmt.println(r.x1, R.y1) Think: What is printed?

9 Two Problems 1. We can t change the fields of a struct inside of a method, i.e., we would like to do the following: func (C Circle) DoubleRadius() { C.radius = 2*C.radius 2. This fixes the problem but is very wasteful of memory since the entire Circle is copied. func (C Circle) DoubleRadius() Circle { C.radius = 2*C.radius return C

10 Solution: Think Meta

11 Courtesy:! pobox321.com!

12 RAM: A Giant Memory Storage Facility

13 Pointers: One Solution to Two Problems Pointer: A variable that holds the address (in memory) of some other variable. var b int = -14 var a *int = &b //* = pointer to //& = location of -14 Courtesy: Benutzer! (Wikimedia Commons)!

14 Accessing Struct Fields with a Pointer var C Circle var pointertoc *Circle // at this point, pointertoc == nil // which Circle does pointertoc point to?

15 Accessing Struct Fields with a Pointer var C Circle var pointertoc *Circle // at this point, pointertoc == nil // which Circle does pointertoc point to? pointertoc = &C // pointertoc points to the Circle named C

16 Accessing Struct Fields with a Pointer var C Circle var pointertoc *Circle // at this point, pointertoc == nil // which Circle does pointertoc point to? pointertoc = &C // pointertoc points to the Circle named C (*pointertoc).x1= -1.7 // change x coordinate of center of C

17 Accessing Struct Fields with a Pointer var C Circle var pointertoc *Circle // at this point, pointertoc == nil // which Circle does pointertoc point to? pointertoc = &C // pointertoc points to the Circle named C (*pointertoc).x1= -1.7 // change x coordinate of center of C pointertoc.x1= -1.7 // this is equivalent to make things easy!

18 Pointers Help Us Change Fields Inside Method Before, we couldn t change fields inside a method... func (C Circle) DoubleRadius() { C.radius = 2*C.radius Solution: Take a pointer to a Circle as the input. func (C *Circle) DoubleRadius() { C.radius = 2*C.radius // note double-meaning of *

19 Pointers Help Us Change Fields Inside Method Go doesn t mind if C isn t even a pointer! func main() { var C Circle C.radius = 2 C.DoubleRadius()

20 Pointers Help Us Change Fields Inside Method We get a pointer when using new with a struct. func main() { var C Circle C.radius = 2 C.DoubleRadius() D := new(circle) // D has type *Circle, but no big deal! D.x1, D.y1 = -1.4, 3.19

21 Quick Quiz Think: What does the following print? func ChangeFirst(list []int) { list[0] = 1 list := make([]int, 10) ChangeFirst(list) fmt.println(list[0])

22 Quick Quiz Think: What does the following print? func ChangeFirst(list []int) { list[0] = 1 list := make([]int, 10) ChangeFirst(list) fmt.println(list[0]) Answer: 1... and now we can say that this is because slices are really pointers to underlying arrays.

23 We Have Already Been Working with This! type Canvas struct { gc *draw2d.imagegraphiccontext img image.image width int height int Pointer to a struct that represents the pen An object that represents the image MoveTo(c *Canvas, x, y float64) LineTo(c *Canvas, x, y float64) SetStrokeColor(c *Canvas, col color.color) SetFillColor(c *Canvas, col color.color) SetLineWidth(c *Canvas, w float64) Stroke(c *Canvas) FillStroke(c *Canvas) Fill(c *Canvas) ClearRect(c *Canvas, x1, y1, x2, y2 int) SaveToPNG(c *Canvas, filename string) Width(c *Canvas) Height(c *Canvas)

24 More Practice Exercise: Say that we have a collection of one-way flights between cities. Design an object-oriented approach to represent the flight network. Courtesy: PIT airport

Objects, Object-Oriented Design, Methods /

Objects, Object-Oriented Design, Methods / Objects, Object-Oriented Design, Methods 02-201 / 02-601 Objects Top-down design: start from the big problem and break it into smaller problems, writing a function for each of the smaller problems Another

More information

Lecture 16: Object-oriented Programming

Lecture 16: Object-oriented Programming Carl Kingsford, 0-0, Fall 05 Lecture 6: Object-oriented Programming Programming languages provide many ways to help you organize your code. Functions are the most important and we've seen a lot of examples

More information

Quick Review of Object-Oriented Programming in Go

Quick Review of Object-Oriented Programming in Go Quick Review of Object-Oriented Programming in Go 02-201 Structs: Grouping Variables as Objects type Rectangle struct { x1 float64 y1 float64 width float64 height float64 type Circle struct { x1 float64

More information

Issue with Implementing PrimeSieve() in Go

Issue with Implementing PrimeSieve() in Go Slices 02-201 Issue with Implementing PrimeSieve() in Go func PrimeSieve(n int) [n+1]bool { var iscomposite [n+1]bool //ERROR! biggestprime := 2 for biggestprime < n for i:=2; i

More information

Pointers /

Pointers / Pointers 02-201 / 02-601 Complex Literal Data Example func main() { company := make(map[string]teaminfo) company["applewatch"] = TeamInfo{ teamname: "applewatch", meetingtime: 10, members: []Employee{

More information

Lecture Overview Methods and Interfaces Methods review Interfaces Example: using the sort interface Anonymous fields in structs

Lecture Overview Methods and Interfaces Methods review Interfaces Example: using the sort interface Anonymous fields in structs 1 Lecture Overview Methods and Interfaces Methods review Interfaces Example: using the sort interface Anonymous fields in structs Generic printing using the empty interface Maps Creating a map Accessing

More information

Homework 5: Spatial Games : Programming for Scientists Due: Thursday, March 3, 2016 at 11:59 PM

Homework 5: Spatial Games : Programming for Scientists Due: Thursday, March 3, 2016 at 11:59 PM Homework 5: Spatial Games 02-201: Programming for Scientists Due: Thursday, March 3, 2016 at 11:59 PM 1. Reading Read Ch. 8 and Ch. 9 of An Introduction to Programming in Go (on pointers and structs).

More information

Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz

Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz Erlang and Go (CS262a, Berkeley Fall 2016) Philipp Moritz The Problem Distributed computation is hard! State Hard to do recovery, dependency on order of execution Concurrency and Synchronization Hard to

More information

Welcome to CSC148! Introduction to Computer Science

Welcome to CSC148! Introduction to Computer Science Welcome to CSC148! Introduction to Computer Science Amir H. Chinaei, Summer 2016 ahchinaei@cs.toronto.edu http://www.cs.toronto.edu/~ahchinaei/ Office hours: R 10 BA4222 Today Course Outline (bird s-eye

More information

Lexical and Syntax Analysis

Lexical and Syntax Analysis Lexical and Syntax Analysis (of Programming Languages) Abstract Syntax Lexical and Syntax Analysis (of Programming Languages) Abstract Syntax What is Parsing? Parser String of characters Data structure

More information

Lexical and Syntax Analysis. Abstract Syntax

Lexical and Syntax Analysis. Abstract Syntax Lexical and Syntax Analysis Abstract Syntax What is Parsing? Parser String of characters Data structure Easy for humans to write Easy for programs to process A parser also checks that the input string

More information

Question: How can we compare two objects of a given class to see if they are the same? Is it legal to do: Rectangle r(0,0,3,3);,, Rectangle s(0,0,4,4)

Question: How can we compare two objects of a given class to see if they are the same? Is it legal to do: Rectangle r(0,0,3,3);,, Rectangle s(0,0,4,4) Classes and Objects in C++: Operator Overloading CSC 112 Fall 2009 Question: How can we compare two objects of a given class to see if they are the same? Is it legal to do: Rectangle r(0,0,3,3);,, Rectangle

More information

A Slice of Life

A Slice of Life A Slice of Life 02-201 More on Slices Last Time: append() and copy() Operations s := make([]int, 10)! s = append(s, 5)! 0! 0! 0! 0! 0! 0! 0! 0! 0! 0! 5! 0! 1! 2! 3! 4! 5! 6! 7! 8! 9! 10! s! c := make([]int,

More information

TUTORIAL: D3 (1) Basics. Christoph Kralj Manfred Klaffenböck

TUTORIAL: D3 (1) Basics. Christoph Kralj Manfred Klaffenböck TUTORIAL: D3 (1) Basics Christoph Kralj christoph.kralj@univie.ac.at Manfred Klaffenböck manfred.klaffenboeck@univie.ac.at Overview Our goal is to create interactive visualizations viewable in your, or

More information

Module 01 Processing Recap. CS 106 Winter 2018

Module 01 Processing Recap. CS 106 Winter 2018 Module 01 Processing Recap CS 106 Winter 2018 Processing is a language a library an environment Variables A variable is a named value. It has a type (which can t change) and a current value (which can

More information

The Awesomeness of Go. Igor Lankin DevFest Karlsruhe, Nov 2016

The Awesomeness of Go. Igor Lankin DevFest Karlsruhe, Nov 2016 The Awesomeness of Go Igor Lankin DevFest Karlsruhe, Nov 2016 Igor Lankin Software Developer @ inovex C#, Java, Java Script, full-time GO (waipu.tv ) 2 What is Go? 3 An Awesome Programming Language 4 Imagine

More information

Introduzione a Go e RPC in Go

Introduzione a Go e RPC in Go Università degli Studi di Roma Tor Vergata Dipartimento di Ingegneria Civile e Ingegneria Informatica Introduzione a Go e RPC in Go Corso di Sistemi Distribuiti e Cloud Computing A.A. 2017/18 Valeria Cardellini

More information

Computer Programming

Computer Programming Computer Programming Dr. Deepak B Phatak Dr. Supratik Chakraborty Department of Computer Science and Engineering IIT Bombay Session: Coordinate based Graphics Guest Lecturer: Dr. Abhiram Ranade Quick recap

More information

Lecture 9: Lists. Lists store lists of variables. Declaring variables that hold lists. Carl Kingsford, , Fall 2015

Lecture 9: Lists. Lists store lists of variables. Declaring variables that hold lists. Carl Kingsford, , Fall 2015 Carl Kingsford, 0-0, Fall 0 Lecture : Lists Terminology: Go uses a non-standard term slice to refer to what we are calling lists. Others use the term array for the same concept. Unfortunately, Go uses

More information

Prof. Carl Schultheiss MS, PE. CLASS NOTES Lecture 12

Prof. Carl Schultheiss MS, PE. CLASS NOTES Lecture 12 Prof. Carl Schultheiss MS, PE CLASS NOTES Lecture 12 In addition to the basic data types C supports user-defined data types. Userdefined data types allow the development of programs using data types that

More information

Clean Classes. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 11

Clean Classes. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 11 Clean Classes Christopher Simpkins chris.simpkins@gatech.edu Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS 1331 1 / 11 Data Abstraction with Classes Consider a concrete Point data type: public

More information

Homework 5: Graphics Due: 11:59pm on Thursday, October 22

Homework 5: Graphics Due: 11:59pm on Thursday, October 22 02-201 Homework 5: Graphics Due: 11:59pm on Thursday, October 22 1. Set up 1. Create a directory called go someplace (different than where you have installed Go) 2. Inside of that directory create a directory

More information

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created.

+ Inheritance. Sometimes we need to create new more specialized types that are similar to types we have already created. + Inheritance + Inheritance Classes that we design in Java can be used to model some concept in our program. For example: Pokemon a = new Pokemon(); Pokemon b = new Pokemon() Sometimes we need to create

More information

CS21: INTRODUCTION TO COMPUTER SCIENCE. Prof. Mathieson Fall 2018 Swarthmore College

CS21: INTRODUCTION TO COMPUTER SCIENCE. Prof. Mathieson Fall 2018 Swarthmore College CS21: INTRODUCTION TO COMPUTER SCIENCE Prof. Mathieson Fall 2018 Swarthmore College Outline Oct 8: Sit somewhere new! One more stack example Introduction to object-oriented programming Start graphics Random

More information

2.2 Volumes of Solids of Revolution

2.2 Volumes of Solids of Revolution 2.2 Volumes of Solids of Revolution We know how to find volumes of well-established solids such as a cylinder or rectangular box. What happens when the volume can t be found quite as easily nice or when

More information

Suppose we store information and employees and teams using the following types:

Suppose we store information and employees and teams using the following types: Carl Kingsford, 0-0, Fall 0 Lecture : Pointers Suppose we store information and employees and teams using the following types: 7 8 9 0 type TeamInfo struct { teamname string meetingtime int members []Employee

More information

Arrays and Strings

Arrays and Strings Arrays and Strings 02-201 Arrays Recall: Fibonacci() and Arrays 1 1 2 3 5 8 13 21 34 55 a Fibonacci(n) a ß array of length n a[1] ß 1 a[2] ß 1 for i ß 3 to n a[i] ß a[i-1] + a[i-2] return a Declaring Arrays

More information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

Object Design Guidelines

Object Design Guidelines Object Design Guidelines 1 / 17 Design Smells Rigidity system is too hard to change becuase change in one place forces changes in many other places Fragility changes break things that are conceptually

More information

Object-Oriented Programming Concepts

Object-Oriented Programming Concepts Object-Oriented Programming Concepts Real world objects include things like your car, TV etc. These objects share two characteristics: they all have state and they all have behavior. Software objects are

More information

Painting your window

Painting your window The Paint event "Painting your window" means to make its appearance correct: it should reflect the current data associated with that window, and any text or images or controls it contains should appear

More information

Introduction to Programming. Structures

Introduction to Programming. Structures Introduction to Programming Structures Mahmoud El-Gayyar elgayyar@ci.suez.edu.eg We need to compute the volume of a box = height * width * length What is the Problem? What if you need to compute the volume

More information

Homework 6: Spatial Games Due: 11:59pm on Friday, October 30

Homework 6: Spatial Games Due: 11:59pm on Friday, October 30 02-201 Homework 6: Spatial Games Due: 11:59pm on Friday, October 30 1. Set up The set up is the basically the same as for homework 4. 1. Create a directory called go someplace (different than where you

More information

Graphics Overview ECE2893. Lecture 19. ECE2893 Graphics Overview Spring / 15

Graphics Overview ECE2893. Lecture 19. ECE2893 Graphics Overview Spring / 15 Graphics Overview ECE2893 Lecture 19 ECE2893 Graphics Overview Spring 2011 1 / 15 Graphical Displays 1 Virtually all modern computers use a full color Graphical Display device. 2 It displays images, text,

More information

Type Analysis. Type Checking vs. Type Inference

Type Analysis. Type Checking vs. Type Inference Type Analysis Is an operator applied to an incompatible operand? Type checking: Static: Check for type compatibility at compile time Dynamic: Check for type compatibility at run time Type analysis phase

More information

Area and Volume. where x right and x left are written in terms of y.

Area and Volume. where x right and x left are written in terms of y. Area and Volume Area between two curves Sketch the region and determine the points of intersection. Draw a small strip either as dx or dy slicing. Use the following templates to set up a definite integral:

More information

Page 129 Exercise 5: Suppose that the joint p.d.f. of two random variables X and Y is as follows: { c(x. 0 otherwise. ( 1 = c. = c

Page 129 Exercise 5: Suppose that the joint p.d.f. of two random variables X and Y is as follows: { c(x. 0 otherwise. ( 1 = c. = c Stat Solutions for Homework Set Page 9 Exercise : Suppose that the joint p.d.f. of two random variables X and Y is as follows: { cx fx, y + y for y x, < x < otherwise. Determine a the value of the constant

More information

ALGEBRA II UNIT X: Conic Sections Unit Notes Packet

ALGEBRA II UNIT X: Conic Sections Unit Notes Packet Name: Period: ALGEBRA II UNIT X: Conic Sections Unit Notes Packet Algebra II Unit 10 Plan: This plan is subject to change at the teacher s discretion. Section Topic Formative Work Due Date 10.3 Circles

More information

Now it only remains to supply the code. Begin by creating three fonts:

Now it only remains to supply the code. Begin by creating three fonts: Owner-Draw Menus Normal menus are always drawn in the same font and the same size. But sometimes, this may not be enough for your purposes. For example, here is a screen shot from MathXpert: Notice in

More information

Module 01 Processing Recap

Module 01 Processing Recap Module 01 Processing Recap Processing is a language a library an environment Variables A variable is a named value. It has a type (which can t change) and a current value (which can change). Variables

More information

Advanced Internet Programming CSY3020

Advanced Internet Programming CSY3020 Advanced Internet Programming CSY3020 Java Applets The three Java Applet examples produce a very rudimentary drawing applet. An Applet is compiled Java which is normally run within a browser. Java applets

More information

CMSC 104 -Lecture 5 John Y. Park, adapted by C Grasso

CMSC 104 -Lecture 5 John Y. Park, adapted by C Grasso CMSC 104 -Lecture 5 John Y. Park, adapted by C Grasso 1 Topics Naming Variables Declaring Variables Using Variables The Assignment Statement 2 a + b Variables are notthe same thing as variables in algebra.

More information

Surface Area and Volume

Surface Area and Volume Surface Area and Volume Day 1 - Surface Area of Prisms Surface Area = The total area of the surface of a three-dimensional object (Or think of it as the amount of paper you ll need to wrap the shape.)

More information

COMP 250. Lecture 29. interfaces. Nov. 18, 2016

COMP 250. Lecture 29. interfaces. Nov. 18, 2016 COMP 250 Lecture 29 interfaces Nov. 18, 2016 1 ADT (abstract data type) ADT s specify a set of operations, and allow us to ignore implementation details. Examples: list stack queue binary search tree priority

More information

If the ball goes off either the right or left edge, turn the ball around. If x is greater than width or if x is less than zero, reverse speed.

If the ball goes off either the right or left edge, turn the ball around. If x is greater than width or if x is less than zero, reverse speed. Conditionals 75 Reversing the Polarity of a Number When we want to reverse the polarity of a number, we mean that we want a positive number to become negative and a negative number to become positive.

More information

Compact Off-Heap Structures in the Java Language

Compact Off-Heap Structures in the Java Language Steve Poole May 2013 Compact Off-Heap Structures in the Java Language Important Disclaimers THE INFORMATION CONTAINED IN THIS PRESENTATION IS PROVIDED FOR INFORMATIONAL PURPOSES ONLY. WHILST EFFORTS WERE

More information

1. More jquery Methods 2. JavaScript + SVG: Raphaël 3. About SVG 4. Working with SVG 5. Animating SVG

1. More jquery Methods 2. JavaScript + SVG: Raphaël 3. About SVG 4. Working with SVG 5. Animating SVG CMPT 165 INTRODUCTION TO THE INTERNET AND THE WORLD WIDE WEB By Hassan S. Shavarani UNIT6: JAVASCRIPT AND GRAPHICS 1 TOPICS 1. More jquery Methods 2. JavaScript + SVG: Raphaël 3. About SVG 4. Working with

More information

Range Reporting. Range Reporting. Range Reporting Problem. Applications

Range Reporting. Range Reporting. Range Reporting Problem. Applications Philip Bille Problem problem. Preprocess at set of points P R 2 to support report(x1, y1, x2, y2): Return the set of points in R P, where R is rectangle given by (x1, y1) and (x2, y2). Applications Relational

More information

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com

More C++ : Vectors, Classes, Inheritance, Templates. with content from cplusplus.com, codeguru.com More C++ : Vectors, Classes, Inheritance, Templates with content from cplusplus.com, codeguru.com 2 Vectors vectors in C++ basically arrays with enhancements indexed similarly contiguous memory some changes

More information

CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010

CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010 CS16 Final Exam E03, 10S, Phill Conrad, UC Santa Barbara Wednesday, 06/09/2010 Name: Umail Address: @ umail.ucsb.edu Circle Lab section: 9AM 10AM 11AM Noon Link to Printer Friendly PDF Version Please write

More information

Object-Oriented Programming in Processing

Object-Oriented Programming in Processing Object-Oriented Programming in Processing Object-Oriented Programming We ve (kinda) been doing this since Day 1: Python is a deeply object oriented language Most of the data types we were using (strings,

More information

Objects. say something to express one's disapproval of or disagreement with something.

Objects. say something to express one's disapproval of or disagreement with something. Objects say something to express one's disapproval of or disagreement with something. class Person: def init (self, name, age): self.name = name self.age = age p1 = Person("John", 36) class Person: def

More information

A student was asked to point out interface elements in this code: Answer: cout. What is wrong?

A student was asked to point out interface elements in this code: Answer: cout. What is wrong? A student was asked to point out interface elements in this code: Answer: cout. What is wrong? Clarification of the concept of INTERFACE The interface we ve been talking about in OOP is not the man-machine

More information

QUIZ. Source:

QUIZ. Source: QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Ch. 4: Data Abstraction The only way to get massive increases in productivity is to leverage off other people s code. That

More information

Arrays/Slices Store Lists of Variables

Arrays/Slices Store Lists of Variables Maps 02-201 Arrays/Slices Store Lists of Variables H i T h e r e! 0 1 2 3 4 5 6 7 8 1 1 2 3 5 8 13 21 34 55 89 0 1 2 3 4 5 6 7 8 9 10 ACG TTA GAG CCT TAA GGG CAT 0 1 2 3 4 5 6 What if Indices Aren t Integers?

More information

We start by looking at a double cone. Think of this as two pointy ice cream cones that are connected at the small tips:

We start by looking at a double cone. Think of this as two pointy ice cream cones that are connected at the small tips: Math 1330 Conic Sections In this chapter, we will study conic sections (or conics). It is helpful to know exactly what a conic section is. This topic is covered in Chapter 8 of the online text. We start

More information

The S.O.L.I.D. Principles. of Object Oriented Programming

The S.O.L.I.D. Principles. of Object Oriented Programming The S.O.L.I.D. Principles of Object Oriented Programming Object-Oriented programming Encapsulation Abstraction Inheritance Polymorphism Decoupling Inheritance Parent (Base) class Child (Derived) Class

More information

QUIZ. What are 3 differences between C and C++ const variables?

QUIZ. What are 3 differences between C and C++ const variables? QUIZ What are 3 differences between C and C++ const variables? Solution QUIZ Source: http://stackoverflow.com/questions/17349387/scope-of-macros-in-c Solution The C/C++ preprocessor substitutes mechanically,

More information

Problem 1: Textbook Questions [4 marks]

Problem 1: Textbook Questions [4 marks] Problem 1: Textbook Questions [4 marks] Answer the following questions from Fluency with Information Technology. Chapter 3, Short Answer #8: A company that supplies connections to the Internet is called

More information

Data Visualization (CIS/DSC 468)

Data Visualization (CIS/DSC 468) Data Visualization (CIS/DSC 468) Data Dr. David Koop SVG Example http://codepen.io/dakoop/pen/ yexvxb

More information

Pointers and scanf() Steven R. Bagley

Pointers and scanf() Steven R. Bagley Pointers and scanf() Steven R. Bagley Recap Programs are a series of statements Defined in functions Can call functions to alter program flow if statement can determine whether code gets run Loops can

More information

Outline. Review of Last Week II. Review of Last Week. Computer Memory. Review Variables and Memory. February 7, Data Types

Outline. Review of Last Week II. Review of Last Week. Computer Memory. Review Variables and Memory. February 7, Data Types Data Types Declarations and Initializations Larry Caretto Computer Science 16 Computing in Engineering and Science February 7, 25 Outline Review last week Meaning of data types Integer data types have

More information

Conditionals & Loops /

Conditionals & Loops / Conditionals & Loops 02-201 / 02-601 Conditionals If Statement if statements let you execute statements conditionally. true "then" part condition a > b false "else" part func max(a int, b int) int { var

More information

Collisions/Reflection

Collisions/Reflection Collisions/Reflection General Collisions The calculating whether or not two 2D objects collide is equivalent to calculating if the two shapes share a common area (intersect). For general polygons this

More information

Mobile Application Programming. Layout Techniques

Mobile Application Programming. Layout Techniques Mobile Application Programming Layout Techniques Legend View Controller Containers & Content Window Container View Content View View Property View Controller Reference Delegate Root View Header View Add

More information

<script type="text/javascript" src="breakout.js"> </script>

<script type=text/javascript src=breakout.js> </script> This lesson brings together everything we've learned so far. We will be creating a breakout game. You can see it on http://www.ripcoder.com/classnotes/32/8/breakout.html It is great to think that you have

More information

CS2 Assignment A1S The Simple Shapes Package

CS2 Assignment A1S The Simple Shapes Package CS2 Assignment A1S The Simple Shapes Package Overview In this project you will create a simple shapes package consisting of three interfaces and three classes. In abstract terms, you will establish classes

More information

Grade 7/8 Math Circles Fall Nov.4/5 The Pythagorean Theorem

Grade 7/8 Math Circles Fall Nov.4/5 The Pythagorean Theorem 1 Faculty of Mathematics Waterloo, Ontario Centre for Education in Mathematics and Computing Grade 7/8 Math Circles Fall 2014 - Nov.4/5 The Pythagorean Theorem Introduction A right triangle is any triangle

More information

Outline. Inheritance. Abstract Classes Interfaces. Class Extension Overriding Methods Inheritance and Constructors Polymorphism.

Outline. Inheritance. Abstract Classes Interfaces. Class Extension Overriding Methods Inheritance and Constructors Polymorphism. Outline Inheritance Class Extension Overriding Methods Inheritance and Constructors Polymorphism Abstract Classes Interfaces 1 OOP Principles Encapsulation Methods and data are combined in classes Not

More information

Outline. Data Definitions and Templates Syntax and Semantics Defensive Programming

Outline. Data Definitions and Templates Syntax and Semantics Defensive Programming Outline Data Definitions and Templates Syntax and Semantics Defensive Programming 1 Data Definitions Question 1: Are both of the following data definitions ok? ; A w-grade is either ; - num ; - posn ;

More information

MACS 261J Final Exam. Question: Total Points: Score:

MACS 261J Final Exam. Question: Total Points: Score: MACS 261J Final Exam May 5, 2008 Name: Question: 1 2 3 4 5 6 7 8 9 Total Points: 15 10 15 5 10 5 20 8 12 100 Score: Question 1............................................................. (15 points) (a)

More information

Today in CS161. Lecture #7. Learn about. Rewrite our First Program. Create new Graphics Demos. If and else statements. Using if and else statements

Today in CS161. Lecture #7. Learn about. Rewrite our First Program. Create new Graphics Demos. If and else statements. Using if and else statements Today in CS161 Lecture #7 Learn about If and else statements Rewrite our First Program Using if and else statements Create new Graphics Demos Using if and else statements CS161 Lecture #7 1 Selective Execution

More information

HO-1: INTRODUCTION TO FIREWORKS

HO-1: INTRODUCTION TO FIREWORKS HO-1: INTRODUCTION TO FIREWORKS The Fireworks Work Environment Adobe Fireworks CS4 is a hybrid vector and bitmap tool that provides an efficient design environment for rapidly prototyping websites and

More information

10.7 Surface Area and Volume of Cylinders

10.7 Surface Area and Volume of Cylinders 10.7. Surface Area and Volume of Cylinders www.ck12.org 10.7 Surface Area and Volume of Cylinders Introduction The Bean Containers Jillian s grandmother loves to cook. One day in between sewing projects,

More information

Bioinformatics Resources

Bioinformatics Resources Bioinformatics Resources Lecture & Exercises Prof. B. Rost, Dr. L. Richter, J. Reeb Institut für Informatik I12 Slides by D. Nechaev Recap! Why do we even bother with JavaScript?! Because JavaScript allows

More information

Singly linked lists in C.

Singly linked lists in C. Singly linked lists in C http://www.cprogramming.com/tutorial/c/lesson15.html By Alex Allain Linked lists are a way to store data with structures so that the programmer can automatically create a new place

More information

CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts)

CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) CISC220 Lab 2: Due Wed, Sep 26 at Midnight (110 pts) For this lab you may work with a partner, or you may choose to work alone. If you choose to work with a partner, you are still responsible for the lab

More information

Covering & Surrounding

Covering & Surrounding Covering & Surrounding Two-Dimensional Measurement and Three-Dimensional Measurement Name: Hour: Table of Contents Investigation 1 Investigation 1.1 page 3 Investigation 1.2 page 7 Investigation 1.3 page

More information

Introduction to the Go Programming Language

Introduction to the Go Programming Language Introduction to the Go Programming Language Basics, Concurrency and Useful Packages Fabian Wenzelmann April 6, 2017 F. Wenzelmann Introduction to Go April 6, 2017 1 / 114 Why Go? What is Go? Go is a programming

More information

We'll dive right in with an example linked list. Our list will hold the values 1, 2, and 3.!

We'll dive right in with an example linked list. Our list will hold the values 1, 2, and 3.! Linked Lists Spring 2016 CS 107 Version I. Motivating Example We'll dive right in with an example linked list. Our list will hold the values 1, 2, and 3. Linked lists can easily grow and shrink. In that

More information

This lecture. Introduction to VRT. Hardware. Implementation levels. Scene-Graph libraries. Computer Graphic libraries

This lecture. Introduction to VRT. Hardware. Implementation levels. Scene-Graph libraries. Computer Graphic libraries Introduction to VRT HT2005 This lecture My research (not in your slides) Theory VRT Basic structures Useful functions Simple demo Mikael Erlandsson mikael.erlandsson@it.uu.se Informationsteknologi 2006-09-01

More information

Introduction to VRT. Interactive Graphical Systems HT2007. Lars Pettersson. Interactive Graphical Systems

Introduction to VRT. Interactive Graphical Systems HT2007. Lars Pettersson. Interactive Graphical Systems Introduction to VRT Interactive Graphical Systems HT2007 Lars Pettersson lwp@it.uu.se Interactive Graphical Systems Implementation levels Application Scene Graph lib. Computer Graphics lib. Hardware Informationsteknologi

More information

COMP200 ABSTRACT CLASSES. OOP using Java, from slides by Shayan Javed

COMP200 ABSTRACT CLASSES. OOP using Java, from slides by Shayan Javed 1 1 COMP200 ABSTRACT CLASSES OOP using Java, from slides by Shayan Javed Abstract Classes 2 3 From the previous lecture: public class GeometricObject { protected String Color; protected String name; protected

More information

Double Integration: Non-Rectangular Domains

Double Integration: Non-Rectangular Domains Double Integration: Non-Rectangular Domains Thomas Banchoff and Associates June 18, 2003 1 Introduction In calculus of one variable, all domains are intervals which are subsets of the line. In calculus

More information

Chapter 2 Exercise Solutions

Chapter 2 Exercise Solutions Chapter 2 Exercise Solutions EX 2.1. EX 2.2. EX 2.3. EX 2.4. EX 2.5. Explain the following programming statement in terms of objects and the services they provide. System.out.println ("I gotta be me!");

More information

More Examples /

More Examples / More Examples 02-201 / 02-601 Debugging How to Debug Debugging is solving a murder mystery: you see the evidence of some failure & you try to figure out what part of the code caused it. It s based on backward

More information

Summary of Go Syntax /

Summary of Go Syntax / Summary of Go Syntax 02-201 / 02-601 Can declare 1 or more variables in same var statement Variables Can optionally provide initial values for all the variables (if omitted, each variable defaults to the

More information

= 25)(10) 10. =

= 25)(10) 10. = 8.5 Volume of Rounded Objects A basic definition of volume is how much space an object takes up. Since this is a three-dimensional measurement, the unit is usually cubed. For example, we might talk about

More information

JAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn how to describe objects and classes and how to define classes and create objects

JAVA PROGRAMMING LAB. ABSTRACT In this Lab you will learn how to describe objects and classes and how to define classes and create objects Islamic University of Gaza Faculty of Engineering Computer Engineering Dept Computer Programming Lab (ECOM 2114) ABSTRACT In this Lab you will learn how to describe objects and classes and how to define

More information

Web Programming 1 Packet #5: Canvas and JavaScript

Web Programming 1 Packet #5: Canvas and JavaScript Web Programming 1 Packet #5: Canvas and JavaScript Name: Objectives: By the completion of this packet, students should be able to: use JavaScript to draw on the canvas element Canvas Element. This is a

More information

AP Calculus. Areas and Volumes. Student Handout

AP Calculus. Areas and Volumes. Student Handout AP Calculus Areas and Volumes Student Handout 016-017 EDITION Use the following link or scan the QR code to complete the evaluation for the Study Session https://www.surveymonkey.com/r/s_sss Copyright

More information

AP * Calculus Review. Area and Volume

AP * Calculus Review. Area and Volume AP * Calculus Review Area and Volume Student Packet Advanced Placement and AP are registered trademark of the College Entrance Examination Board. The College Board was not involved in the production of,

More information

Programming in C++: Assignment Week 4

Programming in C++: Assignment Week 4 Programming in C++: Assignment Week 4 Total Marks : 20 August 12, 2017 Question 1 Which of the following operators can use friend functions for overloading? Mark 1 a. == b. [ ] c. -> d. ( ) Answer: a As

More information

blur Melissa Kaufman-Gomez Team Leader Timothy Goodwin System Architect Dexter Callender Language Guru Daniel Hong Test Wizard

blur Melissa Kaufman-Gomez Team Leader Timothy Goodwin System Architect Dexter Callender Language Guru Daniel Hong Test Wizard blur Melissa Kaufman-Gomez Team Leader Timothy Goodwin System Architect Dexter Callender Language Guru Daniel Hong Test Wizard blur : -noun. a programming language for creating and modifying ASCII art.

More information

CS7026 HTML5. Canvas

CS7026 HTML5. Canvas CS7026 HTML5 Canvas What is the element HTML5 defines the element as a resolution-dependent bitmap canvas which can be used for rendering graphs, game graphics, or other visual images

More information

Volumes of Solids of Revolution Lecture #6 a

Volumes of Solids of Revolution Lecture #6 a Volumes of Solids of Revolution Lecture #6 a Sphereoid Parabaloid Hyperboloid Whateveroid Volumes Calculating 3-D Space an Object Occupies Take a cross-sectional slice. Compute the area of the slice. Multiply

More information

CSC 102 Lecture Notes Week 1 Introduction to the Course Introduction to Jav a

CSC 102 Lecture Notes Week 1 Introduction to the Course Introduction to Jav a CSC102-S010-L1 Page 1 I. Relevant reading. A. Horstmann chapters 1-6 B. Writeups for Labs 1 and 2 C. Various cited material in writeups CSC 102 Lecture Notes Week 1 Introduction to the Course Introduction

More information

Ce qui est important dans l'enseignement des mathématiques. Marian Small novembre 2017

Ce qui est important dans l'enseignement des mathématiques. Marian Small novembre 2017 Ce qui est important dans l'enseignement des mathématiques Marian Small novembre 2017 Playing with math Uae your linking cubes. Show that the mean of 4, 7 and 7 is 6. Playing with math Uae your linking

More information

Module 05 User Interfaces. CS 106 Winter 2018

Module 05 User Interfaces. CS 106 Winter 2018 Module 05 User Interfaces CS 106 Winter 2018 UI is a big topic GBDA 103: User Experience Design UI is a big topic GBDA 103: User Experience Design CS 349: User Interfaces CS 449: Human-Computer Interaction

More information

Definition 3.1 The partial derivatives of a function f(x, y) defined on an open domain containing (x, y) are denoted by f

Definition 3.1 The partial derivatives of a function f(x, y) defined on an open domain containing (x, y) are denoted by f Chapter 3 Draft October 3, 009 3. Partial Derivatives Overview: Partial derivatives are defined by differentiation in one variable, viewing all others as constant (frozen at some value). The reduction

More information