CompSci 4 Chap 10 Nov 22, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.

Slides:



Advertisements
Similar presentations
Visual Lists By Chris Brown under Prof. Susan Rodger Duke University July 2012.
Advertisements

Introduction to Arrays Chapter What is an array? An array is an ordered collection that stores many elements of the same type within one variable.
CompSci 101 Introduction to Computer Science February 3, 2015 Prof. Rodger Lecture given by Elizabeth Dowd.
CS320n –Visual Programming Class-level Methods and Inheritance – Part 1 Mike Scott (Slides 4-3-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger.
Class-level Methods Chapter 6. Class-level Method Is specific to a class of objects We can give a class new abilities/methods Only involves this one class.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
Class-level Methods and Inheritance MMP 220 Multimedia Programming This adapted material was prepared for students in MMP220 as as part of a curriculum.
Tonight’s JavaScript Topics 1 Conditional Statements: if and switch The Array Object Looping Statements: for, while and do-while.
CompSci 18S Recursion Dec 4, 2006 Prof. Susan Rodger.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
CS320n –Visual Programming Indefinite Loops (Slides 7-2) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Chapter 8 Improving Structure with Inheritance. The DoME Example The Database of Multimedia Entertainment We will be storing information about CDs and.
Arrays and Array Visualization
CS320n –Visual Programming Random Numbers and Random Motion (Slides 6-3) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
1 Lecture Today’s topic Arrays Reading for this Lecture: –Chaper 11.
Fall 2007ACS-1805 Ron McFadyen1 Chapter 4 OO Programming Concepts.
Intro-Sound-part21 Introduction to Processing Digital Sounds part 2 Barb Ericson Georgia Institute of Technology Oct 2009.
Line up By Melissa Dalis Professor Susan Rodger Duke University June 2011.
by Chris Brown under Prof. Susan Rodger Duke University June 2012
CompSci 4 Chap 5 Sec 1 Oct 13, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
When you start Photo Story the title screen gives you three options. The following slides will illustrate the directions when “Begin a new story” has been.
Arrays and Array Visualization Alice. What is an array? An array is a collection of objects or information that is organized in a specific order. The.
Changing Camera Views! Part 2: Simple Scene Change & Lighting Fixes By Bella Onwumbiko under the direction of Professor Susan Rodger Duke University July.
Arrays. Introduction This chapter serves as an introduction to the important topic of data structures. Arrays are data structures consisting of related.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
CompSci 4 Chap 7 Sec 2 Apr 7, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
Nonvisual Arrays and Recursion by Chris Brown under Prof. Susan Rodger Duke University June 2012.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
CompSci 4 Chap 8 Sec 1 Nov 17, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
By Melissa Dalis Professor Susan Rodger Duke University June 2011 Multiplication Table.
Variables and Inheritance A More Complex Example Alice.
CompSci 4 Introduction to Programming Animation and Virtual Worlds Prof. Susan Rodger.
Variables and Inheritance Part 1
CS320n –Visual Programming Introduction to Recursion (Slides 8-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
1 ball, 2 ball, red ball, blue ball By Melissa Dalis Professor Susan Rodger Duke University June 2011.
CS320n – Elements of Visual Programming Lists Mike Scott (Slides 9-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Python Arrays. An array is a variable that stores a collection of things, like a list. For example a list of peoples names. We can access the different.
Computer Programming TCP1224 Chapter 11 Arrays. Objectives Using Arrays Declare and initialize a one-dimensional array Manipulate a one-dimensional array.
CompSci 6 Introduction to Computer Science Sept 29, 2011 Prof. Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not.
CompSci 4 Chap 5 Sec 2 Oct 18, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
CS320n – Elements of Visual Programming Sending Parameters to Event Handler Methods (Slides 5-2) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
Can I get your number? By Melissa Dalis Professor Susan Rodger Duke University June 2011.
CompSci 4 Chap 4 Sec 1 Sept 15, 2005 Prof. Susan Rodger.
Tutorial for Arrays and Lists. Description This presentation will cover the basics of using Arrays and Lists in an Alice world It uses a set of chickens.
Copyright 2008 Wanda Dann, Steve Cooper, Don Slater Alice Workshop Variables & Conditions.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
Lists Alice. Collections In some animations, several objects must perform the same actions Example: A marching band, where the band members are performing.
CS320n –Visual Programming Definite / Counted Loops (Slides 7-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
CompSci 4 Chap 5 Sec 2 Oct 9, 2008 Prof. Susan Rodger.
CompSci 4 Chap 6 Sec 2 Sep 30, 2010 Prof. Susan Rodger “All your troubles are due to those ‘ifs’,” declared the Wizard. If you were not a Flutterbudget.
CompSci 4 Chap 9 Sec 1 October 28, 2010 Prof. Susan Rodger.
CompSci 4 Chap 4 Sec 3 Sept 23, 2010 Prof. Susan Rodger.
Using Placeholders to Simplify your Methods: Learning Methods, Part 2 By Deborah Nelson Duke University Professor Susan Rodger June 16, 2008.
CS320n –Visual Programming Problem Solving Case Study (Slides 6-3) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 4-1 Lecture Objectives To understand: –what values can be stored in a Boolean.
CompSci 101 Introduction to Computer Science November 11, 2014 Prof. Rodger CompSci 101 Fall Review for exam.
CompSci 4 Chap 10 November 4, 2010 Prof. Susan Rodger.
CS320n –Visual Programming Execution Control with If / Else and Boolean Functions (Slides 6-2-1) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
Variables and Inheritance Part 1 Alice. Review: Properties A class defines properties for its own kind of object. When an object is created (instantiated),
CS320n – Elements of Visual Programming List Search Mike Scott (Slides 9-2) Thanks to Wanda Dann, Steve Cooper, and Susan Rodger for slide ideas.
Lists and Iteration in Alice
Arrays and Array Visualization
Variables and Inheritance Part 2
CompSci 101 Introduction to Computer Science
CS320n –Visual Programming
Variables and Inheritance Part 1
Music Creation Create, Record, Produce.
Presentation transcript:

CompSci 4 Chap 10 Nov 22, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas

Announcements We will continue to work with arrays next week. Assignment 7 – Storyboard due today –World is due Thursday next week.

Research Study Continued Your choice whether or not to participate You will be ed your id number from Camelia Pearson Eaves (LSRC D230) I do not know your number or whether you choose to participate Benefit – Take a survey (test) that may help in preparing you for the final exam.

What we will do today Lecture on Chap 10 –Review of variables –Introduce arrays of objects Classwork – practice with arrays

Review: Properties Where is the class? Where is the object? A class defines properties When an object is created it receives is own set of properties

State and Changing State State of object – each property stores info about the object –Example: vehicle isShowing State change

Class-level Variables New variables can be added to the properties of an object –class-level The value of the variable can be changed –The variable is mutable. –Can be used to track state changes.

Inheritance If an object (and its new variable) are saved out and given a new name, a new class is created. –This is inheritance! –The new class inherits all properties and methods of original class. Did this before by adding new methods to a class and saving it out.

Examples in book Switch –Add property “isOn” –Boolean type property Steerable Car –Add property “direction” for amount of turn on front wheels, from –10 to 10 –Number type property

What is an array? An array is a collection of objects or information organized in a specific order The individual components (elements) are of the same type (all object or all number, etc.) Analogy – Music CD –Collection of songs listed in order –CD player allows you to Play songs in order Play songs by specifying its number Play songs in random order

Arrays in Alice In Alice, array is a data structure to organize objects or information An array is not visible, it is a way of organizing But…. –Alice has a 3D model to help you “see” the array

Example – Create a visualization of an array of people Add 5 people to the world Add an array visualization Not an array yet, must add people to the array Positions in array numbered starting with 0

Initialize array - Add Alice to Array in position 0 Alice automatically moves to the 0 position!

Add Soldier to the Array Soldier moves automatically to position 1 (which is the 2cd position)!

Add RandomGuy, Skater and Rockette The array initialization is complete! Set isVisible for arrayVisualization to false –Array not seen

Setting elements in array Objects in an array are called elements Use “let” to set a position in an array Using “let”.

Accessing elements in an array Can specify an element at a particular location in the array

Repeat for all items in the array – in order Use “loop” – complicated version Note: index in loop is used in body What does this do?

Array vs. List Array –Elements are ordered –Can access a particular element – 3 –Use “Loop” - loop over elements – one at a time, OR every second element, etc List –Elements are not ordered –Use “For all in order”, “For all together” – does something to each element in the list – just don’t know the order this occurs

Classwork Today Introduction to arrays