1 The Information School of the University of Washington Oct 30fit100-15-review Programming Review INFO/CSE 100, Fall 2006 Fluency in Information Technology.

Slides:



Advertisements
Similar presentations
Computer Science 103 Chapter 3 Introduction to JavaScript.
Advertisements

1 The Information School of the University of Washington Nov 1fit dom © 2006 University of Washington Document Object Model (DOM) INFO/CSE 100, Fall.
25 October Conditionals and Loops. Presentations Brendan: Cyberwarfare Casey: Online shopping (No current event today)
The Information School of the University of Washington Oct 23 fit functions 1 Functions / If Else INFO/CSE 100, Fall 2006 Fluency in Information.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
The Information School of the University of Washington Dec 8fit review1 Final Exam Review INFO/CSE 100, Fall 2006 Fluency in Information Technology.
CIS101 Introduction to Computing Week 11. Agenda Your questions Copy and Paste Assignment Practice Test JavaScript: Functions and Selection Lesson 06,
29 November JavaScript: Arrays and Iterations Functions.
The Information School of the University of Washington Oct 20fit programming1 Programming Basics INFO/CSE 100, Fall 2006 Fluency in Information Technology.
CIS101 Introduction to Computing Week 12 Spring 2004.
Oct 25 1 The Information School of the University of Washington fit control © 2006 University of Washington Control Flow INFO/CSE 100, Fall 2006.
Introduction to JavaScript for Python Programmers
The Data Element. 2 Data type: A description of the set of values and the basic set of operations that can be applied to values of the type. Strong typing:
JavaScript, Fifth Edition Chapter 1 Introduction to JavaScript.
The Bean Counter: A JavaScript Program
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
SYST Web Technologies SYST Web Technologies Lesson 6 – Intro to JavaScript.
JavaScript Part 1.
Chapter 3 : Processing on the Front End JavaScript Technically its name is ECMA-262, which refers to the international standard which defines it. The standard.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Week 9 PHP Cookies and Session Introduction to JavaScript.
1 Introduction to Javascript Peter Atkinson. 2 Objectives To understand and use appropriately some of the basic elements of Javascript: –alert and prompt.
Chapter 3: Data Types and Operators JavaScript - Introductory.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
CHAPTER 4 Java Script อ. ยืนยง กันทะเนตร คณะเทคโนโลยีสารสนเทศและการสื่อสาร มหาวิทยาลัยพะเยา 1.
Using Client-Side Scripts to Enhance Web Applications 1.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
JavaScript - Basic Concepts Prepared and Presented by Hienvinh Nguyen, Afshin Tiraie.
Introduction to Programming JScript Six Scripting functions Discuss functions Password Example.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
JavaScript, Fourth Edition
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Event Handling (the right way). A Simple Web Page Events - Summary The web page looks like this:
 Labs next week:  Both labs will be posted on Monday  Both will be due the following Monday  Your decision on which to do first ▪ Web App Design Lab.
Today’s Announcements` If you have problems with the assignments, don’t be afraid to ask for help Assignment 6 is due and will be graded before the end.
Tutorial 11 1 JavaScript Operators and Expressions.
CGS 3066: Web Programming and Design Spring 2016 Programming in JavaScript.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
OVERVIEW OF CLIENT-SIDE SCRIPTING
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
JavaScript Tutorial. What is JavaScript JavaScript is the programming language of HTML and the Web Programming makes computers do what you want them to.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
JavaScript Tutorial First lecture 19/2/2016. Javascript is a dynamic computer programming language. It is lightweight and most commonly used as a part.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
Build in Objects In JavaScript, almost "everything" is an object.
CGS 3066: Web Programming and Design Spring 2017
Document Object Model (DOM)
JavaScript.
INFO/CSE 100, Spring 2005 Fluency in Information Technology
INFO/CSE 100, Spring 2006 Fluency in Information Technology
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Event Driven Programming & User Defined Functions
INFO/CSE 100, Spring 2006 Fluency in Information Technology
Introduction to JavaScript for Python Programmers
Document Object Model (DOM)
INFO/CSE 100, Spring 2006 Fluency in Information Technology
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Functions, Regular expressions and Events
INFO/CSE 100, Spring 2006 Fluency in Information Technology
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Tutorial 10: Programming with javascript
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Javascript Chapter 19 and 20 5/3/2019.
Programming Basics Review
Web Programming and Design
CGS 3066: Web Programming and Design Spring 2016
COMPUTING.
Presentation transcript:

1 The Information School of the University of Washington Oct 30fit review Programming Review INFO/CSE 100, Fall 2006 Fluency in Information Technology

2 The Information School of the University of Washington Oct 30fit review Readings and References Reading »Fluency with Information Technology Chapters 9,

3 The Information School of the University of Washington Oct 30fit review Variables In Real Life A variable is a "container" for information you want to store »The name of the variable stays the same, but the value associated with that name can change That’s why it’s called a “variable”!

4 The Information School of the University of Washington Oct 30fit review Variables In Programming Program variables have names and values »Names (also called identifiers) What are the “rules” for variable names? »Values Can they change? What are some valid variable types?

5 The Information School of the University of Washington Oct 30fit review Variable Declarations How do you? Declare variable myName as undefined? Declare variable myName and give it a value (initialize it)? Declare variable myName and give it an empty value (initialize empty)? Change variable myName to new value?

6 The Information School of the University of Washington Oct 30fit review Basic Data Types in Javascript Numbers: var gasPrice = ?????; Strings var eyeColor = ?????; Boolean var isMonday = ?????;

7 The Information School of the University of Washington Oct 30fit review Expressions The right-hand side of an assignment statement can be any valid expression Expressions are “formulas” saying how to manipulate existing values to compute new values How? »Subtract 5.25 from myBalance and save it as myBalance »Save numDaysOld as myAge X 365 »Save isFreezing by evaluating currentTemp less than 32. »Set welcomeMessage as Welcome myName

8 The Information School of the University of Washington Oct 30fit review Operators Use operators to build expressions »Numeric operators + - * / mean add, subtract, multiply, divide answer = 7 + 3; »String operator + means concatenate strings answer = "8" + "2"; »Relational operators = > mean less than, less than or equal to, equal to, not equal to, greater than or equal to, greater than »Boolean operators && || ! mean and, or, not

9 The Information School of the University of Washington Oct 30fit review Functions What is a function? What do the parts of the function layout do? » function ( ) { }

10 The Information School of the University of Washington Oct 30fit review Write a Function Write a simple function to return the number of days given a number of weeks. (example: input = 3 weeks / return = 21 days) function ( ) { } template

11 The Information School of the University of Washington Oct 30fit review Calling a Function function daysInWeeks(weeks) { return 7 * weeks; } // call the function var numWeeks = ; // another function call document.write( ); function calls

12 The Information School of the University of Washington Oct 30fit review Global or Local?!? Scope of a variable describes where and when it can be referenced // Calculate Percentage of Study Hours/Week // time in hours // returns hours var days = 7; function calculateStudyHrs(time) { var totalHrs = 24 * days; var funcTotal = time/totalHrs; return funcTotal; } var total = calculateStudyHrs(4); alert(“Total: “ + total);

13 The Information School of the University of Washington Oct 30fit review Layout of the GUI The layout of the page is controlled with HTML in the body of the page What HTML tag is used to encompass all of the GUI input elements? What are some valid HTML GUI element tags we have learned? HTML form layout and specification

14 The Information School of the University of Washington Oct 30fit review A simple example This GUI has several simple controls. What are they?

15 The Information School of the University of Washington Oct 30fit review Form Controls <button type="button" onclick="setResults('good results')">Good Results <button type="button" onclick="setResults('bad results')">Bad Results Result: <input type="radio" name="case" id="radioLC" checked onclick="setResults(document.getElementById('resultField').value) ">Lowercase <input type="radio" name="case" id="radioUC" onclick="setResults(document.getElementById('resultField').value) ">Uppercase Reset

16 The Information School of the University of Washington Oct 30fit review Events Cause Processing After drawing a page, the browser sits idle waiting for something to happen … when we give input, we cause events Processing events is the task of a block of code called an event handler »The code to execute is identified in the tag using the appropriate attribute »There are many event types onClick, onChange, onMouseOver...

17 The Information School of the University of Washington Oct 30fit review setResults(resultString) parameter variable, local variable, if/else statement, field reference, call to toLowerCase() function function setResults(resultString) { var tempString = resultString; if (document.getElementById("radioLC").checked) { tempString = tempString.toLowerCase(); } else if (document.getElementById("radioUC").checked) { tempString = tempString.toUpperCase(); } document.getElementById("resultField").value = tempString; }

18 The Information School of the University of Washington Oct 30fit review The if / else statement What are the parts? When do they get evaluated / executed? if ( ) { } else { }

19 The Information School of the University of Washington Oct 30fit review More if/else Statements if (cashInPocket < 25.00) { if (parkingTicket == "Expensive") { alert("No more money for me."); } Convert to one if statement.

20 The Information School of the University of Washington Oct 30fit review The for loop What do the different parts do? for (something; something; something) { something; }

21 The Information School of the University of Washington Oct 30fit review i++ What does x = var x = 0; for (i=0; i < 100; i++) { x++; }

22 The Information School of the University of Washington Oct 30fit review body of loop may not execute at all Notice that depending on the values of the control variables, it is quite possible that the body of the loop will not execute at all var itemCount = 0;... for (var i=0; i < itemCount; i++) { document.writeln("..processing item "+i); } check for limit condition itemCount is 0 when we get here, so i<itemCount is immediately false and the loop body is skipped completely

23 The Information School of the University of Washington Oct 30fit review Arrays What is an array? 3 Ways to create an array? How can we tell how many items in array?

24 The Information School of the University of Washington Oct 30fit review JavaScript Indexed Arrays What is the value of the first index on an Array? What is the JavaScript code that will give us the index number of the last element in an Array?

25 The Information School of the University of Washington Oct 30fit review Array Element Access var myArray = [“one”, “three”, “two”, “seven”, “zero”]; How many elements? What is myArray[3]? What is myArray[1];