Khan Academy JavaScript Study Guide
|
|
- Sybil Townsend
- 5 years ago
- Views:
Transcription
1 Khan Academy JavaScript Study Guide Contents 1. Canvas graphics commands with processing.js 2. Coloring 3. Variables data types, assignments, increments 4. Animation with draw loop 5. Math expressions 6. Text and Strings display, concatenate, split 7. Functions parameters, return values 8. Logic if, else, logic operators and, or not 9. Debugging 10. Looping while, for 11. Clean code 12. Arrays 13. Objects properties, methods, inheritance 14. Object oriented design JavaScript is not to be confused with Java. Java is a probably the second most used programming language in use today. The graphic below shows usage statistics on a popular programming website, github.com As you can see, JavaScript is one of the most common languages in use today. 1. How to create an account in Khan Academy Khan Academy is an online school where you watch videos, take quizzes and create programs. Your teacher will track you progress through an online gradebook. Your teacher will provide you with a class code so that he/she will become your coach. 2. What is a programming language? A programming language is a way of providing instructions to the computer. All programs including games, calculators, calendars, word processors, painting applications, web browsers etc. are written in some kind of programming language. 3. What is JavaScript? JavaScript is the most widely used programming language in the world. It is used to power nearly every web site on the Internet. 4. What is processing.js? Kahn Academy uses a library of code to extend JavaScript s capabilities. You can read about it at Programmers often use libraries in all languages to extend the capabilities of JavaScript. 5. Escape from the Khan editor You can take your JavaScript program out of the Khan Academy window and onto any web page by following these instructions.. /how- can- khan- academy- computer- programs- be- run- offline- or- on- my- own- website
2 1. Drawing Shapes Examples rect(10,20,50,100); Draws a rectangle on the screen. The upper left corner is 10 pixels from the left side of the screen and 20 pixels from the top. The rectangle is 50 pixels wide and 100 pixels tall. triangle(100, 410, 200, 200, 300, 410); Draws a triangle on the screen. The three points of the triangle are (100,410), (200,200) and (300,410). Notice that 410 is actually outside of the drawing area. 10, px 200, px 100, ,410 ellipse(10,20,50,100); Draws an ellipse (oval) on the screen. Imagine that you drew the same rectangle used earlier and filled it with an oval. The upper left corner is 10 pixels from the left side of the screen and 20 pixels from the top. The rectangle is 50 pixels wide and 100 pixels tall.. 10,20 line(183, 246, 245, 230); Draws a line on the screen. The two endpoints of 245, px 183, px the line are (183,246) and (245,230).
3 2. Coloring fill(102, 255, 0); Use the fill command to change the color of the next shapes you draw. Use numbers between 0 and 255 to create a combination of red, green and blue light. In this example, fill is used just before each of the scoops of ice cream so that each shape is a different color. stroke(100,200,0); Use the fill command to change the color of the outline of the next shapes you draw. Use numbers between 0 and 255 to create a combination of red, green and blue light. nostroke(); Removes the outline of the next shape drawn. background(255,0,0); Use the background command to paint a large square on the entire canvas. Be sure to use the background command before any other drawings. If you draw a background on top of any image, the image will be hidden.
4 3. Variables A variable is a letter or word used to represent a value. Like letters used in Algebra, the value of a variable can change. Variable example #1 var rectwidth = 20; rect(10, 10, rectwidth, 90); The var command declares a variable. That is, the computer knows that this is a new variable name in the program. The equals sign, =, is called the variable assignment. In this case, the variable rectwidth now holds the number 20. This program would draw a rectangle 20 pixels wide by 90 pixels tall. Variable expressions Varialbes can be used in mathematical expressions. For example, the variables x and y indicate the center of the frog face at the point (200,250). The center of the left eye is at (x- 50, y- 50) or (150,200) The center of the right eye is at (x+50,y- 50) or (250,200) Variable Example #2 eyesize is the value of both the width and height of the ellipse. toothheight is the value of the height of the rectangles that are the teeth.
5 4. Animation Draw The draw function is executed many times each second. Changes to a variable inside the draw function will update the position of shapes to create movement. x = x + 10 on line 20 is the important line of code in this program. It means Add 10 to the value of X and store the answer in the variable x. mousex and mousey Two special variables, mousex and mousey are the coordinates of the mouse arrow on the screen. In this program, the ball moves to follow the mouse.
6 5. Math expressions Use the following symbols to calculate math expressions. + addition - subtraction * multiply / divide ( ) parenthesis are used to group operations. Everything you learned in math class about order of operations is important in programming. For example: var x; var y; var z; x = 10; y = 7; z = 3 * x + y; z would have the value of 37 but in this code var x; var y; var z; x = 10; y = 7; z = 3 * (x + y); z would have the value of 51. z = 3 * (10 + 7)
7 6. Text Strings A string is a word, character or sentence enclosed in quotation marks. text(string, x, y) is the command to write words to the screen. textsize(25) will adjust the size of the letters. For example,
8 7. Functions A function is a collection of statements that are executed or called as a group. Var drawwinston = function() { // draw shapes inside the function brackets Function return values A function can give an answer to a math formula. In this example we find out how many donuts Winston eats in a lifetime. var calctotaldonuts = function(numyears) { return 3 * 365 * numyears; ; text(calctotaldonuts(65), 200, 240); Processing.js special functions Function parameters Numbers are passed to a function through variables called parameters. In this example, the function is called four times using different values for the facex and facey parameters. 1. draw() called multiple times each second. 2. mousemoved() called when the mouse moves 3. mouseclicked() called when the mouse is clicked. Global and local variables A variable that is declared inside a function is discarded when the function ends. This is a local variable. Variables declared in the program are global and retain their value. var lifeinches = 20; // global variable var calcinches = function(startage, endage, inchesperyear) { var totalinches = inchesperyear * (endage - startage); // local variable lifeinches += totalinches; return totalinches; ;
9 8. Logic and if statements If statements compare two numbers and make a decision based on the answer. For example this program will reverse the direction of the ball when it reaches the edge of the screen. The && (and) operator checks if two conditions are both true if ((score > 100) && (lives > 0)) { // the score is greater than 100 and there are more than 0 lives remaining The (or) operator checks if either one of two conditions is true if ((score > 100) (lives > 0)) { // either the score is greater than 100 or there are more than 0 lives remaining, or both conditions are true The! (not) operator checks to see if something is not true If (PresidentName!== Kennedy ) { // the person is not named Kennedy If else Booleans A Boolean value is a true or false answer to a compare problem. For example A single Boolean check If (score > 100) { // the score is greater than 100 The === (check for equals) sign is used to see if two values are identical. The single equals sign (=) is reserved for assigning a value to a variable. If (lives === 0) { // you have no lives. You are dead The else statement allows you to do something else if the statement is false. if (integer === 0) { // do something here else { // do something else else if The else if statement allows you to check another condition if the first one was false. if (number < 1) { // do something else if (number < 2) { // do something else else { // do this if the previous two fail
10 9. Debugging You can check for errors by printing the value of variables on the screen. This lets you see if the variables are actually storing the numbers you think they should. For example notice the values at the bottom of the screen. They help you find errors in your programs.
11 10. Looping While loops 1. Set a variable as a counter 2. Start a while loop 3. Increase or decrease the variable. 4. The loop will stop when the while condition is met. 5. Be careful not to create an infinite loop that never stops. For example For loops A for loop always has three parts: 1. Initial variable setting 2. Conditional check 3. Increase or decrease For example for (var y = 63; y < 313; y += 41) { text("pineapple pizza is the best!", 69, y);
12 11. Clean Code Follow these steps to make your code easier to read. 1. Use good names for variables. var circleradius = 4.2 is better than var cr = Use indenting with if statements, functions and loops. for (var i = numcircles; i > 1; i- - ) { var radius = i * 7; ellipse(mousex, mousey, radius, radius); ; 3. Put spaces between statements and symbols. if (x < 10){ rect(10,10,20,30); is better than if(x<10){rect(10,10,20,30); 4. Use comments to explain what you are trying to do. // Calculate y according to the path of a parabola with respect to "t": // y = (velocity)*t - (acceleration)*t^2; // We can tweak the velocity and acceleration constants for our fake world
13 12. Arrays Arrays are variables that store a collection of values. For example var myfriends = ["Sophia", "John", "Leif", "Winston"]; push You can add items to an array with the push statement. For example text( myfriends[0], 10, 30); text( myfriends[1], 10, 80); text( myfriends[2], 10, 130); length The length statement counts the number of items stored in the array. For example text("i have " + myfriends.length + " friends!!!", 10, 150); Looping through arrays Use a for loop or while loop to do something with each member of an array. For example var myfriends = ["Sophia", "John", "Leif", "Winston", "OhNoes Guy", "Sal"]; var friendnum = 0; while(friendnum < myfriends.length) { text(myfriends[friendnum], 10, 30+friendNum*30); friendnum++; Or like this var myfriends = ["Sophia", "John", "Leif", "Winston", "OhNoes Guy", "Sal"]; for(var friendnum=0;friendnum< myfriends.length; friendnum++) { text(myfriends[friendnum], 10, 30+friendNum*30);
14 13. Objects Objects are collections of properties and actions used together to describe something. Objects are often stored in arrays. For example For example Winston has properties Properties of an object can be modified. For example while(winston.age <= 40) { text("winston is " + winston.age + " years old", 10, winston.age*20-350); winston.age++; if (winston.age === 30) { winston.wife = "Winnefer"; if (winston.age === 32) { winston.twins = ["Winston, JR", "Winstonia"];
15 14. Object oriented design Objects are often created with a constructor function. The function uses the this keyword when referring to the object being created. For example Object Inheritance Objects are based on other objects. In the following example, creature is the first object and Winston and Hopper are descendants of creature. Adding actions to an object with methods A method is a function that gives an object action. You can use the prototype keyword to add a function to an object.
Using Methods. Methods that handle events. Mairead Meagher Dr. Siobhán Drohan. Produced by: Department of Computing and Mathematics
Using Methods Methods that handle events Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Caveat The term function is used in Processing e.g. line(),
More informationCISC 1600 Lecture 3.1 Introduction to Processing
CISC 1600 Lecture 3.1 Introduction to Processing Topics: Example sketches Drawing functions in Processing Colors in Processing General Processing syntax Processing is for sketching Designed to allow artists
More informationUniversity of Cincinnati. P5.JS: Getting Started. p5.js
p5.js P5.JS: Getting Started Matthew Wizinsky University of Cincinnati School of Design HTML + CSS + P5.js File Handling & Management Environment Canvas Coordinates Syntax Drawing Variables Mouse Position
More information+ 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 informationCISC 1600, Lab 2.1: Processing
CISC 1600, Lab 2.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using Sketchpad, a site for building processing sketches online using processing.js. 1.1. Go to http://cisc1600.sketchpad.cc
More informationCISC 1600, Lab 2.2: Interactivity in Processing
CISC 1600, Lab 2.2: Interactivity in Processing Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad, a site for building processing sketches online using processing.js.
More informationConditional Events. Mouse events and Operators. Dr. Siobhán Drohan Mairead Meagher. Produced by:
Conditional Events Mouse events and Operators Produced by: Dr. Siobhán Drohan Mairead Meagher Department of Computing and Mathematics http://www.wit.ie/ Topics list Mouse Events Recap: Arithmetic Operators
More informationCISC 1600, Lab 3.1: Processing
CISC 1600, Lab 3.1: Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1. Go to https://www.openprocessing.org/class/57767/
More information1 Getting started with Processing
cisc3665, fall 2011, lab I.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For
More informationCISC 1600, Lab 3.2: Interactivity in Processing
CISC 1600, Lab 3.2: Interactivity in Processing Prof Michael Mandel 1 Getting set up For this lab, we will be using OpenProcessing, a site for building processing sketches online using processing.js. 1.1.
More informationClass #1. introduction, functions, variables, conditionals
Class #1 introduction, functions, variables, conditionals what is processing hello world tour of the grounds functions,expressions, statements console/debugging drawing data types and variables decisions
More informationBasic Computer Programming (Processing)
Contents 1. Basic Concepts (Page 2) 2. Processing (Page 2) 3. Statements and Comments (Page 6) 4. Variables (Page 7) 5. Setup and Draw (Page 8) 6. Data Types (Page 9) 7. Mouse Function (Page 10) 8. Keyboard
More information[ the academy_of_code] Senior Beginners
[ the academy_of_code] Senior Beginners 1 Drawing Circles First step open Processing Open Processing by clicking on the Processing icon (that s the white P on the blue background your teacher will tell
More informationInteraction Design A.A. 2017/2018
Corso di Laurea Magistrale in Design, Comunicazione Visiva e Multimediale - Sapienza Università di Roma Interaction Design A.A. 2017/2018 7 Conditionals in Processing Francesco Leotta, Andrea Marrella
More informationInteraction Design A.A. 2017/2018
Corso di Laurea Magistrale in Design, Comunicazione Visiva e Multimediale - Sapienza Università di Roma Interaction Design A.A. 2017/2018 8 Loops and Arrays in Processing Francesco Leotta, Andrea Marrella
More informationIntroduction to Processing
Processing Introduction to Processing Processing is a programming environment that makes writing programs easier. It contains libraries and functions that make interacting with the program simple. The
More informationKimberly Nguyen Professor Oliehoek Introduction to Programming 8 September 2013
1. A first program // Create 200x200 canvas // Print favorite quote size(200, 200); println("it is what it is"); // Draw rectangle and a line rect(100,100,50,50); line(0,0,50,50); // Save as.pde. Can be
More informationWatch the following for more announcements
Review "plain text file" loadstrings() split() splittokens() selectinput() println(), float(), int(), can take an array argument, will return an array easy way to convert an array of Strings to an array
More informationInteraction Design A.A. 2017/2018
Corso di Laurea Magistrale in Design, Comunicazione Visiva e Multimediale - Sapienza Università di Roma Interaction Design A.A. 2017/2018 5 Basics of Processing Francesco Leotta, Andrea Marrella Last update
More informationPick a number. Conditionals. Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary. CS Conditionals 1
Conditionals Boolean Logic Relational Expressions Logical Operators Numerical Representation Binary CS105 04 Conditionals 1 Pick a number CS105 04 Conditionals 2 Boolean Expressions An expression that
More information1 Getting started with Processing
cis3.5, spring 2009, lab II.1 / prof sklar. 1 Getting started with Processing Processing is a sketch programming tool designed for use by non-technical people (e.g., artists, designers, musicians). For
More information5.1. Examples: Going beyond Sequence
Chapter 5. Selection In Chapter 1 we saw that algorithms deploy sequence, selection and repetition statements in combination to specify computations. Since that time, however, the computations that we
More informationTHE JAVASCRIPT ARTIST 15/10/2016
THE JAVASCRIPT ARTIST 15/10/2016 Objectives Learn how to program with JavaScript in a fun way! Understand the basic blocks of what makes a program. Make you confident to explore more complex features of
More informationSelf-Teach Exercises 1-12 Turtle Pascal
Self-Teach Exercises 1-12 Turtle Pascal The exercises below are intended to get you started using Turtle Graphics programming, and to take you fairly systematically through some of the basic facilities
More informationmith College Computer Science CSC103 How Computers Work Week 6 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC103 How Computers Work Week 6 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Ben Fry on Processing... http://www.youtube.com/watch?&v=z-g-cwdnudu An Example Mouse 2D
More informationProcessing. Data Visualization Programming Language. By Rutvi Joshi. Processing Visualization Language- By Rutvi Joshi
Processing Data Visualization Programming Language What is Processing? A Graphical Sketch Book and Environment, to graphically teach the fundamentals of computer science But it has evolved into a tool
More informationWe will start our journey into Processing with creating static images using commands available in Processing:
Processing Notes Chapter 1: Starting Out We will start our journey into Processing with creating static images using commands available in Processing: rect( ) line ( ) ellipse() triangle() NOTE: to find
More informationExploring Processing
Exploring Processing What is Processing? Easy-to-use programming environment Let s you edit, run, save, share all in one application Designed to support interactive, visual applications Something we ve
More informationArea and Perimeter Name: Date:
Area and Perimeter Name: Date: RECTANGLE: PARALLELOGRAM: TRIANGLE: TRAPEZOID: PERIMETER: 1. Plot the following points on the graph above: R(-3, 2), T(-3, 7), W(-9, 2), S(-9, 7). Now connect the points.
More informationComputer Graphics. Interaction
Computer Graphics Interaction Jordi Linares i Pellicer Escola Politècnica Superior d Alcoi Dep. de Sistemes Informàtics i Computació jlinares@dsic.upv.es http://www.dsic.upv.es/~jlinares processing allows
More informationCS 101 Functions. Lecture 15
CS 101 Functions Lecture 15 1 Key Processing language features so-far Basic color/shapes drawing Variables For-loops If-statements 2 Functions In the next few days, we ll be talking about Functions A Function
More informationWhat can we do with Processing? Let s check. Natural Language and Dialogue Systems Lab Guest Image. Remember how colors work.
MIDTERM REVIEW: THURSDAY I KNOW WHAT I WANT TO REVIEW. BUT ALSO I WOULD LIKE YOU TO TELL ME WHAT YOU MOST NEED TO GO OVER FOR MIDTERM. BY EMAIL AFTER TODAY S CLASS. What can we do with Processing? Let
More informationProcessing Assignment Write- Ups
Processing Assignment Write- Ups Exercise 1-1 Processing is not an elaborate series of points like connect the dots or is it? Can t be cause I got it all wrong when I mapped out each and every point that
More informationmith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut
mith College Computer Science CSC103 How Computers Work Week 7 Fall 2017 Dominique Thiébaut dthiebaut@smith.edu Important Review Does the animation leave a trace? Are the moving objects move without a
More informationRecall that creating or declaring a variable can be done as follows:
Lesson 2: & Conditionals Recall that creating or declaring a variable can be done as follows:! float radius = 20;! int counter = 5;! string name = Mr. Nickel ;! boolean ispressed = true;! char grade =
More informationIntroduction to Processing. Sally Kong
Introduction to Processing Sally Kong - Open Source Platform - Geared toward creating visual, interactive media - Created by Ben Fry and Casey Reas Basic Setup void setup() { size(800, 600); background(255);
More informationGRAPHICS & INTERACTIVE PROGRAMMING. Lecture 1 Introduction to Processing
BRIDGES TO COMPUTING General Information: This document was created for use in the "Bridges to Computing" project of Brooklyn College. This work is licensed under the Creative Commons Attribution-ShareAlike
More informationSolution Notes. COMP 151: Terms Test
Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms
More informationCISC 1600, Lab 2.3: Processing animation, objects, and arrays
CISC 1600, Lab 2.3: Processing animation, objects, and arrays Prof Michael Mandel 1 Getting set up For this lab, we will again be using Sketchpad. sketchpad.cc in your browser and log in. Go to http://cisc1600.
More informationIteration in Programming
Iteration in Programming for loops Produced by: Mairead Meagher Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topics list There are three types of loop in programming: While
More informationTopic Notes: Java and Objectdraw Basics
Computer Science 120 Introduction to Programming Siena College Spring 2011 Topic Notes: Java and Objectdraw Basics Event-Driven Programming in Java A program expresses an algorithm in a form understandable
More informationHello Tejas + - / + - * / + - * /+ - * / Name$ = Tejas Print Hello +Name$ * / - * / + - * / * / + - */+ + - * */ Print Input Rect Circ
+ - / ct Circle e Print Input Rect Circle / cle * / + - * / + - * /+ - * / Name$ = Tejas Print Hello +Name$ Print Input Rect Circle + - * / + - * /+ - * / ircle e Print Input Rect Circle Hello Tejas -
More informationCSE120 Wi18 Final Review
CSE120 Wi18 Final Review Practice Question Solutions 1. True or false? Looping is necessary for complex programs. Briefly explain. False. Many loops can be explicitly written out as individual statements
More informationA B C D CS105 03a Interaction
Interaction Function Definition Events Built-in Variables CS105 03a Interaction 1 Which image is drawn by this code? strokeweight(10); stroke(0, 255, 0); // green line(99, 0, 0, 99); stroke(200, 0, 200);
More informationCOMP Summer 2015 (A01) Jim (James) Young jimyoung.ca
COMP 1010- Summer 2015 (A01) Jim (James) Young young@cs.umanitoba.ca jimyoung.ca order of operations with the explicit cast! int integervariable = (int)0.5*3.0; Casts happen first! the cast converts the
More informationFinal Exam Winter 2013
Final Exam Winter 2013 1. Which modification to the following program makes it so that the display shows just a single circle at the location of the mouse. The circle should move to follow the mouse but
More informationRepetition is the reality and the seriousness of life. Soren Kierkegaard
6 Loops Loops 81 Repetition is the reality and the seriousness of life. Soren Kierkegaard What s the key to comedy? Repetition. What s the key to comedy? Repetition. Anonymous In this chapter: The concept
More informationc.def (pronounced SEE-def) Language Reference Manual
c.def (pronounced SEE-def) Macromedia Flash TM animation language Language Reference Manual Dennis Rakhamimov (dr524@columbia.edu), Group Leader Eric Poirier (edp29@columbia.edu) Charles Catanach (cnc26@columbia.edu)
More informationAdd the backgrounds. Add the font.
To find all sprites, font, and backgrounds look in your resources folder under card game. Pick sprites for the following: The Mouse Desired Objects A disappearing animation for the desired objects Clutter
More informationCS110 Introduction to Computing Fall 2016 Practice Exam 1 -- Solutions
CS110 Introduction to Computing Fall 2016 Practice Exam 1 -- Solutions The exam will be closed-note and closed-book; please consider this fact before using your notes on this practice version. Please see
More informationCSc 110, Autumn 2016 Lecture 7: Graphics. Adapted from slides by Marty Stepp and Stuart Reges
CSc 110, Autumn 2016 Lecture 7: Graphics Adapted from slides by Marty Stepp and Stuart Reges Graphical objects We will draw graphics in Python using a new kind of object: DrawingPanel: A window on the
More informationWorking with JavaScript
Working with JavaScript Creating a Programmable Web Page for North Pole Novelties 1 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page 2 Objectives
More informationACTIVE PROCESSING Summary Learning Objectives How to Proceed Check your Understanding Learning Objectives 412
ACTIVE PROCESSING Summary This is a difficult unit we finally move away from boring calculation programs and start to have programs that animate and you can interact with. These are called active programs
More informationStreet Artist Teacher support materials Hour of Code 2017
Street Artist Street Artist Teacher support materials Hour of Code 07 Kano Hour of Code Street Artist Kano Hour of Code Challenge : Warmup What the ll make A random circle drawer that fills the screen
More informationIT101. Graphical User Interface
IT101 Graphical User Interface Foundation Swing is a platform-independent set of Java classes used for user Graphical User Interface (GUI) programming. Abstract Window Toolkit (AWT) is an older Java GUI
More informationCS Problem Solving and Object-Oriented Programming
CS 101 - Problem Solving and Object-Oriented Programming Lab 5 - Draw a Penguin Due: October 28/29 Pre-lab Preparation Before coming to lab, you are expected to have: Read Bruce chapters 1-3 Introduction
More informationModule 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 informationChapter 4 The If Then Statement
The If Then Statement Conditional control structure, also called a decision structure Executes a set of statements when a condition is true The condition is a Boolean expression For example, the statement
More informationIf 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 informationCMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts
CMPSCI 119 LAB #2 Greebles / Anime Eyes Professor William T. Verts The goal of this Python programming assignment is to write your own code inside a provided program framework, with some new graphical
More informationStandards/ Strands Essential Questions Skills Assessment. What are the strengths and weaknesses of Processing as a programming language?
WDHS Curriculum Map Course: Introduction to Computer Science 2 Time Interval/ Content Standards/ Strands Essential Questions Skills Assessment Unit 1: Introduction to 2 weeks Learning Lesson 1 (Chapters
More informationBasic Input and Output
Basic Input and Output CSE 120 Winter 2019 Instructor: Teaching Assistants: Justin Hsia Ann Shan, Eunia Lee, Pei Lee Yap, Sam Wolfson, Travis McGaha Facebook to integrate WhatsApp, Instagram and Messenger
More informationBasic Input and Output
Basic Input and Output CSE 120 Spring 2017 Instructor: Justin Hsia Teaching Assistants: Anupam Gupta, Braydon Hall, Eugene Oh, Savanna Yee Administrivia Assignments: Animal Functions due today (4/12) Reading
More informationDesign Programming DECO2011
Design Programming DECO2011 Rob Saunders web: http://www.arch.usyd.edu.au/~rob e-mail: rob@arch.usyd.edu.au office: Room 274, Wilkinson Building Data, Variables and Flow Control What is a Variable? Computers
More informationVariables. location where in memory is the information stored type what sort of information is stored in that memory
Variables Processing, like many programming languages, uses variables to store information Variables are stored in computer memory with certain attributes location where in memory is the information stored
More informationAcknowledgments. Who Should Read This Book?...xxiv How to Read This Book...xxiv What s in This Book?...xxv Have Fun!...xxvi
Contents IN DeTAIl Acknowledgments xxi Introduction xxiii Who Should Read This Book?....xxiv How to Read This Book....xxiv What s in This Book?...xxv Have Fun!...xxvi Part I: Fundamentals 1 What Is JavaScript?
More information2D Shapes. Creative Coding & Generative Art in Processing 2 Ira Greenberg, Dianna Xu, Deepak Kumar
2D Shapes Creative Coding & Generative Art in Processing 2 Ira Greenberg, Dianna Xu, Deepak Kumar Did you do this? Read Chapter 2 (pages 33-50) Read and do the Coordinate Systems & Shapes and Color tutorials
More informationCOMS 469: Interactive Media II
COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client
More informationModule 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 informationProcedures: Algorithms and Abstraction
Procedures: Algorithms and Abstraction 5 5.1 Objectives After completing this module, a student should be able to: Read and understand simple NetLogo models. Make changes to NetLogo procedures and predict
More informationName: Bootstrap:2. Class:
Name: Bootstrap:2 Class: Lesson 1 Racket Code (define AGE 14) (define A-NUMBER 0.6) (define SPEED -90) Pyret Code AGE = 14 A-NUMBER = 0.6 SPEED = -90 Numbers Two of your own: (define CLASS Bootstrap )
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More informationIn this lesson you will learn: How to capture the input from the user. How to write programs using variables and lists. Athletics Swimming Gymnastics
Lesson 4 A m In this lesson you will learn: How to capture the input from the user. How to write programs using variables and lists. Advanced Scratch Sports Day Jyoti and Tejas are planning to create a
More informationAnimations involving numbers
136 Chapter 8 Animations involving numbers 8.1 Model and view The examples of Chapter 6 all compute the next picture in the animation from the previous picture. This turns out to be a rather restrictive
More informationLesson 6 page 1. If you look at the bottom right of the Scratch color choices, you will see it say MORE BLOCKS in Purple.
Lesson 6 page 1 LESSON 6: Feb 17-24 Hello everyone! We are going to learn about BYOB this week. This acronym stands for Build Your Own Blocks. If you look at the bottom right of the Scratch color choices,
More informationJavaScript. History. Adding JavaScript to a page. CS144: Web Applications
JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary
More informationDecisions, Decisions. Testing, testing C H A P T E R 7
C H A P T E R 7 In the first few chapters, we saw some of the basic building blocks of a program. We can now make a program with input, processing, and output. We can even make our input and output a little
More informationAdobe Flash CS3 Reference Flash CS3 Application Window
Adobe Flash CS3 Reference Flash CS3 Application Window When you load up Flash CS3 and choose to create a new Flash document, the application window should look something like the screenshot below. Layers
More informationVisual C# Program: Simple Game 3
C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a
More informationTransform 1: Translate, Matrices
Transform 1: Translate, Matrices This unit introduces coordinate system transformations and explains how to control their scope. Syntax introduced: translate(), pushmatrix(), popmatrix() The coordinate
More informationPLT Miscellaneous Libraries: Reference Manual
PLT Miscellaneous Libraries: Reference Manual PLT (scheme@plt-scheme.org) Version 200 June 2002 Copyright notice Copyright c 1996-2002 PLT Permission to make digital/hard copies and/or distribute this
More informationSession 3: JavaScript - Structured Programming
INFM 603: Information Technology and Organizational Context Session 3: JavaScript - Structured Programming Jimmy Lin The ischool University of Maryland Thursday, September 25, 2014 Source: Wikipedia Types
More informationMathematical Reasoning. Lesson 37: Graphing Quadratic Equations. LESSON 37: Graphing Quadratic Equations
LESSON 37: Graphing Quadratic Equations Weekly Focus: quadratic equations Weekly Skill: graphing Lesson Summary: For the warm-up, students will solve a problem about mean, median, and mode. In Activity
More informationChapter 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 informationWhat is a variable? a named location in the computer s memory. mousex mousey. width height. fontcolor. username
What is a variable? a named location in the computer s memory mousex mousey width height fontcolor username Variables store/remember values can be changed must be declared to store a particular kind of
More informationCustom Shapes As Text Frames In Photoshop
Custom Shapes As Text Frames In Photoshop I used a background for this activity. Save it and open in Photoshop: Select Photoshop's Custom Shape Tool from the Tools panel. In the custom shapes options panel
More informationChapter 3 Syntax, Errors, and Debugging. Fundamentals of Java
Chapter 3 Syntax, Errors, and Debugging Objectives Construct and use numeric and string literals. Name and use variables and constants. Create arithmetic expressions. Understand the precedence of different
More informationThis is the vector graphics "drawing" technology with its technical and creative beauty. SVG Inkscape vectors
1 SVG This is the vector graphics "drawing" technology with its technical and creative beauty SVG Inkscape vectors SVG 2 SVG = Scalable Vector Graphics is an integrated standard for drawing Along with
More informationChapter 17. Fundamental Concepts Expressed in JavaScript
Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program
More informationThis lesson combines vertical translations and dilations in several quadratic and inverse variation modeling applications.
Learning Objectives Combined Vertical Transformations Algebra ; Pre-Calculus Time required: 90 min. This lesson combines vertical translations and dilations in several quadratic and inverse variation modeling
More informationAlgebra 2 Semester 1 (#2221)
Instructional Materials for WCSD Math Common Finals The Instructional Materials are for student and teacher use and are aligned to the 2016-2017 Course Guides for the following course: Algebra 2 Semester
More informationif / if else statements
if / if else statements December 1 2 3 4 5 Go over if notes and samples 8 9 10 11 12 Conditionals Quiz Conditionals TEST 15 16 17 18 19 1 7:30 8:21 2 8:27 9:18 3 9:24 10:14 1 CLASS 7:30 8:18 1 FINAL 8:24
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationREVIEW. while (condition) { <body> for (<init> ; <condition> ; <increment>) { } if (condition) { <command> } else { <command> }
REVIEW while (condition) { } for ( ; ; ) { } if (condition) { } else { } CHALLENGE PROBLEMS (from lecture 4) // sum up all elements of an array A
More informationRecipes4Success. Animate Plant Growth. Share 4 - Animation
Recipes4Success In this Recipe, you will create an animated science diagram of plant growth. You will learn how to add images, draw shapes, use the animation options, preview, and publish your project.
More informationUNIT 11 VOLUME AND THE PYTHAGOREAN THEOREM
UNIT 11 VOLUME AND THE PYTHAGOREAN THEOREM INTRODUCTION In this Unit, we will use the idea of measuring volume that we studied to find the volume of various 3 dimensional figures. We will also learn about
More informationLoops. Variable Scope Remapping Nested Loops. Donald Judd. CS Loops 1. CS Loops 2
Loops Variable Scope Remapping Nested Loops CS105 05 Loops 1 Donald Judd CS105 05 Loops 2 judd while (expression) { statements CS105 05 Loops 3 Four Loop Questions 1. What do I want to repeat? - a rect
More informationGetting Started with JS-Eden
Getting Started with JS-Eden This activity will guide you through an introduction to JS-Eden. Starting JS-Eden You can open JS-Eden by pointing your web browser to: http://harfield.org.uk/jsedencanvas/
More informationINTRODUCTION TO PROCESSING. Alark Joshi, Amit Jain, Jyh-haw Yeh and Tim Andersen
INTRODUCTION TO PROCESSING Alark Joshi, Amit Jain, Jyh-haw Yeh and Tim Andersen What is Processing? Processing is a programming language designed to make programming easier Developers were frustrated with
More information1. Complete these exercises to practice creating user functions in small sketches.
Lab 6 Due: Fri, Nov 4, 9 AM Consult the Standard Lab Instructions on LEARN for explanations of Lab Days ( D1, D2, D3 ), the Processing Language and IDE, and Saving and Submitting. Rules: Do not use the
More information