Review Array – int[] diameters = new int[10]; – diameters[0], diameters[2], diameters[9] – diameters.length Indexing starts at 0 A way to have a collection.

Slides:



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

Additional Programming Concepts MVRT 2011 – 2012 Season.
Hold data and provide access to it. Random-access containers: -Allow accessing any element by index -arrays, vectors Sequential containers: -Allow accessing.
ArrayLists The lazy mans array. Whats the matter here? int[] list = new int[10]; list[0] = 5; list[2] = hey; list[3] = 15; list[4] = 23;
CS 141 Computer Programming 1 1 Arrays. Outline  Introduction  Arrays  Declaring Arrays  Examples Using Arrays  Sorting Arrays  Multiple-Subscripted.
Chapter 6 Lists and Dictionaries CSC1310 Fall 2009.
Lesson Four: More of the Same
Data Structure (Part I) Stacks and Queues. Introduction to Stack An stack is a ordered list in which insertion and deletions are made at one end. –The.
String and Lists Dr. Benito Mendoza. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list List.
Our Toolkit Graphics – lines, shapes, images, text, color, … Data of Various Types – Numbers (with and without decimal places) – Booleans (true, false)
 9: Arrays  Why?  What is an Array?  Declaring and Creating an Array  Initializing and Array  Array Operations  Array Examples  Arrays of Objects.
, Fall 2006IAT 800 Lab 2: Polygons, Transformations, and Arrays.
Aalborg Media Lab 28-Jun-15 Software Design Lecture 8 “Arrays”
Concatenation MATLAB lets you construct a new vector by concatenating other vectors: – A = [B C D... X Y Z] where the individual items in the brackets.
Chapter 6 Arrays & Clusters. LabVIEW Arrays > Collection of Elements > Same Data Type > Variable-Sized > One or More Dimensions.
Lecture 5 of Computer Science II Arrays Instructor: Mr.Ahmed Al Astal.
Arrays & Linked Lists Last Update: Aug 21, 2014EECS2011: Arrays & Linked Lists1.
Microsoft® Small Basic
COMPUTER SCIENCE FEBRUARY 2011 Lists in Python. Introduction to Lists Lists (aka arrays): an ordered set of elements  A compound data type, like strings.
Lists in Python.
Data Structures in Python By: Christopher Todd. Lists in Python A list is a group of comma-separated values between square brackets. A list is a group.
Geometers Sketch pad. Step 1: Open Sketch pad Use this to select items Use this to draw a point Use this to draw a circle Use this to draw a line Use.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
How to start Visual Studio 2008 or 2010 (command-line program)
M. Taimoor Khan Javascript Objects  Every data-type defined in Javascript is an object  It has a class definition for.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 17 – Flag Quiz Application Introducing One-Dimensional.
Built-in Data Structures in Python An Introduction.
Arrays Art &Technology, 3rd Semester Aalborg University Programming David Meredith
Review Loops – Condition – Index Functions – Definition – Call – Parameters – Return value.
By Jonathan Villanueva. Bubble Sorting: the way to sort an array by switching two values that are right next to each other if the first number bigger.
Collections behaviour and implementation of collections of primitives and objects.
Lists. The list is a most versatile datatype available in Python which can be written as a list of comma-separated values (items) between square brackets.
CS320n –Visual Programming
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 8 Lists and Tuples.
Daniel Jung. Types of Data Structures  Lists Stacks Queues  Tuples  Sets  Dictionaries.
Project 1: Using Arrays and Manipulating Strings Essentials for Design JavaScript Level Two Michael Brooks.
Arrays. An array is a collection “The Dinner offers an array of choices.” In computer programming, an array is a collection of variables of the same data.
APS105 Lists. Structures Arrays allow a collection of elements –All of the same type How to collect elements of different types? –Structures; in C: struct.
Arrays1 © 2014 Goodrich, Tamassia, Goldwasser Presentation for use with the textbook Data Structures and Algorithms in Java, 6 th edition, by M. T. Goodrich,
Computation as an Expressive Medium Lab 2: Polygons, Transformations, and Arrays Evan.
Introducing Arrays in C. PURPOSE: Storing multiple data items under the same name Example:  Salaries of 10 employees  Percentage of marks of my dear.
Computer Science I Arrays. Parallel structures. Classwork/Homework: Build your own bouncing things.
Sorting Algorithm Analysis. Sorting  Sorting is important!  Things that would be much more difficult without sorting: –finding a phone number in the.
CSCI 3328 Object Oriented Programming in C# Chapter 8: LINQ and Generic Collections – Exercises 1 Xiang Lian The University of Texas – Pan American Edinburg,
Working with Loops, Conditional Statements, and Arrays.
Guide to Programming with Python Chapter Five Lists and dictionaries (data structure); The Hangman Game.
COMPUTER PROGRAMMING 2 ArrayLists. Objective/Essential Standard Essential Standard 3.00Apply Advanced Properties of Arrays Essential Indicator 3.02 Apply.
Trig. Functions & the Unit Circle. Trigonometry & the Unit Circle VERY important Trig. Identity.
LISTS and TUPLES. Topics Sequences Introduction to Lists List Slicing Finding Items in Lists with the in Operator List Methods and Useful Built-in Functions.
Arrays and Lists. What is an Array? Arrays are linear data structures whose elements are referenced with subscripts. Just about all programming languages.
- draw a diameter - make a radius - join diameter and radius -join other end of diameter and radius - put in any angle for one of the angles formed - fill.
Review Objects – data fields – constructors – Methods Classes.
Chapter 6 Arrays & Clusters. LabVIEW Arrays > Collection of Elements > Same Data Type > Variable-Sized > One or More Dimensions.
Arrays. 2 Why do we care (about arrays)? What if you have a whole bunch of cars (or aliens or balls or ???) bouncing around the screen? How do we keep.
String and Lists Dr. José M. Reyes Álamo. 2 Outline What is a string String operations Traversing strings String slices What is a list Traversing a list.
Lists/Dictionaries. What we are covering Data structure basics Lists Dictionaries Json.
String and Lists Dr. José M. Reyes Álamo.
Containers and Lists CIS 40 – Introduction to Programming in Python
Polygons, Transformations, and Arrays
ARRAYS MIT-AITI Copyright 2001.
A NEW look at PowerPoint
Perl Variables: Array Web Programming.
Data Structures – 1D Lists
String and Lists Dr. José M. Reyes Álamo.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
Fundaments of Game Design
EET 2259 Unit 9 Arrays Read Bishop, Sections 6.1 to 6.3.
Intro to Computer Science CS1510 Dr. Sarah Diesburg
RANDOM NUMBERS SET # 1:
Python List.
Presentation transcript:

Review Array – int[] diameters = new int[10]; – diameters[0], diameters[2], diameters[9] – diameters.length Indexing starts at 0 A way to have a collection of variables instead of individual ones

Built-in Array Functions append( array, item ) – returns a new array expanded by one and add item to end expand( array, newSize ) – returns a new array with size increased to newSize shorten( array ) – returns a new array shortened by one concat( array1, array2 ) – returns a new array that is the concatenation of array1 and array2 subset( array, offset [, length] ) – returns a subset of array starting at offset and proceeding for length (or end) splice( array, value|array2, index ) or – returns a new array with value or array2 inserted at index sort( array ) – returns a new array sorted numerically or alphabetically reverse( array ) – returns a new array with all elements reversed in order

Trigonometry on a unit circle q r p 0°0° 90 ° origin

Trigonometry on a unit circle 0°0° 90 ° q

Drawing points along a circle int steps = 8; int radius = 20; float angle = 2*PI/steps; for (int i=0; i<steps; i++) { float x = sin(angle*i)*radius; float y = cos(angle*i)*radius; // draw a point every 1/8th of a circle ellipse(x, y, 10, 10); }

Polygon 0°0° 90 °

Star 0°0° 90 °

Pop A game that measures your balloon-popping skill. How it should work… – As game runs, randomly placed balloons inflate – When the player pops (clicks on) a balloon, 1 point is earned – Points are added up throughout the game duration – If one click is over top multiple balloons, all balloons pop and multiple points are earned – The game runs for 30 seconds, and then ends