Arrays II Robin Burke IT 130. Outline Homework #6 Portfolio Array review Array examples Array algorithms Multi-dimensional arrays.

Slides:



Advertisements
Similar presentations
Outline lecture Revise arrays Entering into an array
Advertisements

Peer Feedback. In the homework section on the web for today: In the homework section on the web for today: 1. Open the link in the file and log into
JavaScript Part 6. Calling JavaScript functions on an event JavaScript doesn’t have a main function like other programming languages but we can imitate.
Programming with Microsoft Visual Basic th Edition
COM311H Zheng, School of C&M, UUJ1 Dynamic Web Authoring JavaScript Basics (Array and Function)
Tonight’s JavaScript Topics 1 Conditional Statements: if and switch The Array Object Looping Statements: for, while and do-while.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
1 A Balanced Introduction to Computer Science, 2/E David Reed, Creighton University ©2008 Pearson Prentice Hall ISBN Chapter 17 JavaScript.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Tutorial 12 Working with Arrays, Loops, and Conditional Statements
Technical Writing II Acknowledgement: –This lecture notes are based on many on-line documents. –I would like to thank these authors who make the documents.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
Information Technology Center Hany Abdelwahab Computer Specialist.
Web-based Application Development Lecture 18 March 21, 2006 Anita Raja.
Chapter 9 Introduction to Arrays
JavaScript Events and Event Handlers 1 An event is an action that occurs within a Web browser or Web document. An event handler is a statement that tells.
(Title Page) Enter name of topic here Enter group members names here.
JS Arrays, Functions, Events Week 5 INFM 603. Agenda Arrays Functions Event-Driven Programming.
Informer Web Reporting Basic Reporting
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 11 - JavaScript: Arrays Outline 11.1 Introduction 11.2 Arrays 11.3 Declaring and Allocating Arrays.
Lists in Python.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
The Document Object Model. Goals Understand how a JavaScript can communicate with the web page in which it “lives.” Understand how to use dot notation.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
© 2000 – All Rights Reserved - Page 1 Introduction to JavaScript Programming Part Two.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Searching and Sorting Chapter Sorting Arrays.
Object-Oriented Program Development Using Java: A Class-Centered Approach, Enhanced Edition.
Java Script: Arrays (Chapter 11 in [2]). 2 Outline Introduction Introduction Arrays Arrays Declaring and Allocating Arrays Declaring and Allocating Arrays.
VB Games: Preparing for Memory Brainstorm controls & events Parallel structures (again), Visibility, LoadPicture, User-defined procedures, Do While/Loop,busy.
1 Flow Control II Code: Select-Case and For-Next Controls: Frames and OptionButtons.
Tutorial 51 Programming Structures Sequence - program instructions are processed, one after another, in the order in which they appear in the program Selection.
Working with Files. Learning Objectives By the end of this lecture, you should be able to: – Examine a file that contains code with unfamiliar material,
EIW - ASP Introduction1 Active Server Pages VBScript.
SE 320 – Introduction to Game Development Lecture 3: Unity’s Interface and Concepts Lecturer: Gazihan Alankuş Please look at the last two slides for assignments.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
Welcome to Mr. Cripps’ Social Sciences Informational Site.
Creating Web Documents catch-up JavaScript slide show tools redirection.
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
Loops.  (No Quiz)  Hand in Assignment #1  Last chance for Q+A on the midterm  Loops 2.
Arrays, Methods, Error Handling. Using Arrays as Parameters int[] anArray = ; int index = min(anArray); // Index of smallest int index = search(anArray,
IS2802 Introduction to Multimedia Applications for Business Lecture 3: JavaScript and Functions Rob Gleasure
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
MIS 3200 – Unit 5.1 Iteration (looping) – while loops – for loops Working with List Items.
Working with Loops, Conditional Statements, and Arrays.
Welcome to NU 304 Instructor: Kelley Edds, MSN, APN-BC.
Grouping Robin Burke ECT 360. Outline Extra credit Numbering, revisited Grouping: Sibling difference method Uniquifying in XPath Grouping: Muenchian method.
JavaScript II ECT 270 Robin Burke. Outline Functions Events and event handling Form validation.
XP Tutorial 3 New Perspectives on JavaScript, Comprehensive1 Working with Arrays, Loops, and Conditional Statements Creating a Monthly Calendar.
Introduction to Arrays. Learning Objectives By the end of this lecture, you should be able to: – Understand what an array is – Know how to create an array.
Strings Robin Burke IT 130. Outline Objects Strings methods properties Basic methods Form validation.
 2008 Pearson Education, Inc. All rights reserved JavaScript: Arrays.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
Data Structures & Algorithms CHAPTER 2 Arrays Ms. Manal Al-Asmari.
COM621: Advanced Interactive Web Development Lecture 6 – JavaScript (cont.)
CHAPTER #7 Problem Solving with Loop. Overview Loop logical structure Incrementing Accumulating WHILE/WHILE-END FOR Nested loop Pointer Algorithmic instruction.
Outline lecture Revise arrays Entering into an array
Programming the Web using XHTML and JavaScript
The relational operators
© Akhilesh Bajaj, All rights reserved.
Academic Communication Lesson 3
Programming in JavaScript
CIS 16 Application Development Programming with Visual Basic
Programming in JavaScript
Lecture 4: Introduction to Code Analysis
Chapter 17 JavaScript Arrays
Software Development Techniques
Presentation transcript:

Arrays II Robin Burke IT 130

Outline Homework #6 Portfolio Array review Array examples Array algorithms Multi-dimensional arrays

Homework #6 Three component grades Knowledge Reasoning Communication Overall very good papers! Many nice site designs

Issues Target marketing not really possible for campaign web site you have to identify the audience that will use such a site not choose the audience and build site to suit Narrow content site has only policy positions and events easy to find these things real site would have much more Design justification report should justify design choices example: information hierarchy each page has foreground and background what belongs in each category what visual techniques distinguish

Portfolio Must include new copies of each homework exceptions if full credit, just copy homework #6 – report only  MS Word.doc or PDF file  no "original" needed Do not include labs homework #6 designs / notes Due date Midnight, 11/22 (Monday before Thanksgiving)

Portfolio Do Get started early you now have enough experience that early assignments should be easy (or at least easier) Aim for full credit on all assignments send me if you don't understand the grading feedback Read the original assignment Don't Wait until the last minute Ignore what the grader had to say

Portfolio site it130 hwk1 hwk2...etc... portfolio index.html  points to old and new assignments hwk1 hwk2 hwk3...etc.. Example

Array Array is a list of values accessed by index name[index] foo[5] Must create before using foo = new Array (); Zero-based indexing length attribute arr.length

Using for loop to access array For loop pieces initial counter value: 0 exit test: value < array.length change to counter: + 1 Pattern for (i = 0; i < arr.length; i++) { do something to arr[i] element }

Images array twodice page from last week document.images[imgNo].src = "dice01.jpg"; How to read this from the document object the page get the images array a list of all the images on the page get one item from this array using imgNo as index some particular image set the src attribute of this image to the given value

Example n dice

Array algorithms Common tasks with arrays find an element with some property combine the elements of the array fill an array with values sort the elements

Combination example: average var total = 0; for (i = 0; i < numbers.length; i++) { total = total + numbers[i]; } ave = total / numbers.length;

Combination pattern Assume array contains some values var variable = empty value ; for (i = 0; i < array.length; i++) { variable = accumulate ( variable, array[i] ); }

Example build-sentence.html Assemble a sentence using the words in an array words = new Array ("welcome", "to", "arrays", "in", "JavaScript"); function result = "welcome to arrays in JavaScript"

Selection example Find the first element in the array less than zero for (i = 0; i < array.length; i++) { if (array[i] < 0) return i; } return -1;

Selection pattern for (i = 0; i < array.length; i++) { if ( test (array[i])) return i; or return array[i]; } return not found value ;

Selection Example Find the smallest element of an array A bit different from pattern We have to look at every element save the best so far

Fill example Fill an array with zeros for (i = 0; i < count; i++) { array[i] = 0; }

Fill pattern for (i = 0; i < size ; i++) { array[i] = initial value ; }

Example Alternate dice idea Fill array with image urls Pick from array instead of if statement Usually a good idea

Parallel arrays Sometimes we have data that is paired state / # of electoral votes homework / date due We can handle this with two arrays same size corresponding indices mean corresponding data

Example duedate.html

Problem Easy for arrays to get out of sync Two things to keep track of The pairing is in the programmer's head not represented in the structure of the data

Multi-dimensional array We can change our data structure instead of two arrays of elements, which are paired we can have one array of pairs Example

Homework #8 Slide show Add rewind, fast-forward, and back buttons Use enable / disable Write a function that controls the buttons so enable / disable logic is not repeated

Monday Data representation