CMPT 100 : INTRODUCTION TO

Size: px
Start display at page:

Download "CMPT 100 : INTRODUCTION TO"

Transcription

1 CMPT 100 : INTRODUCTION TO COMPUTING TUTORIAL #5 : JAVASCRIPT 2 GUESSING GAME 1 By Wendy Sharpe

2 BEFORE WE GET STARTED... If you have not been to the first tutorial introduction JavaScript then you must catch up on your own time Log onto the lab computer (in Windows) Create a folder for this tutorial on H:// drive Log onto Moodle and open tutorial 5 notes Click on guessinggame.html link and save to your newly created folder Open Notepad++ Start All Programs Course Specific Applications Notepad+++ 2

3 TUTORIAL 5 OVERVIEW The Guessing Game Algorithm Overview of JavaScript s Math class Alert() function vs Prompt() function While loop general structure and condition if-else : filling out the body of the while loop if-else : ending the game Debugging JavaScript 3

4 4 THE GUESSING GAME ALGORITHM

5 SETTING UP THE ALGORITHM FOR THE GAME computer picks a number while user hasn't guessed correctly and they haven't reached 7 guesses get a guess from the user if number is too high, say so if number is too low, say so increment number of guesses by 1 if they've guessed correctly, display congratulations else display game over message TIP: typing the algorithm into your assignment as comments will ensure you get the 2 full marks for properly commenting your code. 5

6 PICKING VARIABLES FROM THE CODE computer picks a number while user hasn't guessed correctly and they haven't reached 7 guesses get a guess from the user if number is too high, say so if number is too low, say so increment number of guesses by 1 if they've guessed correctly, display congratulations else display game over message Set up 3 variables in your script for the guessing game follow good naming conventions see tutorial 4 notes 6

7 QUICK REFRESHER ON VARIABLES You MUST first declare the variable before you can use it in your code E.g., var mynumber Variable names are case sensitive (mynumber and MYNumber are two different variables) Variable names must begin with a letter or the underscore character For more information and additional help understanding variables: 7

8 8 JAVASCRIPT S MATH CLASS

9 MATH CLASS Math.random() Doesn t take any arguments, brackets are empty Generates a random number like you can prove to yourself that it works by putting it into your code BUT this isn t an integer! So we need to round it off Math.round() Used for rounding off numbers, using it, any supplied argument is rounded off to the nearest integer E.g., Math.round(25.9) //returns 26 Takes one argument One is an integer argument, E.g., 1, 3, 10, 1000 etc. Integers should show up as red in highlighted syntax on Notepad++ var number = Math.round(Math.random()*100); 9

10 HELP! ERROR CONSOLE MESSAGES Error: math is not defined Source File: file:///h:/cmpt100tutorial5/ guessinggame.htmlline: 11 If you get an error like this, check: Spelling Proper capitalization Semi-colons 10

11 11 ALERT() VS PROMPT()

12 ALERT() FUNCTION Display the instructions for the game using the alert() function alert( my text for the alert goes in here"); For more reading on the alert() function: basic/alert.html Go ahead and set up the first alert for the game 12

13 REMEMBER THE PROMPT() FUNCTION FROM LAST WEEK S TUTORIAL? General structure: prompt( this is your physical prompt text, default ); Good programming practice is to always leave a default value in your prompt Use = to assign the value of the prompt to the variable that you are prompting the user for E.g., animal = prompt("enter a kind of animal","duck"); Go ahead and use the prompt() function to ask the user to enter a number don t forget the default value don t forget the put the value into one of your three variables! we don t have strings this time, so what will our default value look like? 13

14 14 WHILE() LOOP

15 WHILE LOOP STRUCTURE General structure If you put a semi-colon at the end of the while loop the computer will assume that the loop is finished and the body of the while loop won t execute while(some condition); { // my code goes here } vs. while(some condition) { // my code goes here } 15

16 HOW DO YOU FIGURE OUT WHAT CONDITION TO USE FOR YOUR LOOP? you need to figure out what conditions need to be true in order for the loop to keep executing I.e., refer back to your algorithm Refine your algorithm into code for the outside part of the loop: while user hasn't guessed correctly and they haven't reached 7 guesses while (user hasn't guessed correctly and they haven't reached 7 guesses) while (user hasn't guessed correctly AND they haven't reached 7 guesses) while (usernumber!= number && numberguesses < 7) 16

17 IF-ELSE : FILLING OUT THE BODY OF THE WHILE LOOP 17

18 IF General structure of the if-statement: if( true ) { document.write( hello, world! ); } OR if( true ) document.write( hello, world! ); The second case only works when there will be one single line of code after the if( true ) 18

19 ELSE General structure of the else: Still use brackets No need to use round parentheses for the else if(true) { } else { } document.write( hello, world! ); // unlike the if, the else doesn t get a condition in parentheses. document.write( goodbye, world! ); for more help in understanding if-else, visit: 19

20 USING OUR ALGORITHM TO FILL IN THE BODY OF THE WHILE LOOP Go ahead and fill in the while loop using the algorithm from the tutorial notes if you re really struggling to understand while loops, check out: body of the while loop from our algorithm: get a guess from the user if number is too high, say so if number is too low, say so increment number of guesses by 1 NOTE: we already asked the user to enter a value, and we incremented our numberguesses counter. What does this mean for the order of the code? Should we ask for another guess before or after we check the first guess 20

21 21 IF-ELSE : ENDING THE GAME

22 FILL IN THE END-GAME WITH IF-ELSE STRUCTURE if they've guessed the number correctly, they've won the game using document.write( ), tell them they've won using document.write( ), confirm the correct answer and tell them how to restart the game change the background color of the page to yellow, using document.bgcolor="yellow" else the game is over because they have no guesses left. using document.write( ), tell them the game is over using document.write( ), give them the correct answer and tell them how to restart the game change the background color of the page to red, using document.bgcolor="red";. 22

23 USING BGCOLOR Use with the. E.g., document.bgcolor = color; If you re using a variable E.g., document.bgcolor = red ; If you re just using a colour Needs to be the last line in your block of code with document.write() commands otherwise the document.write will write over the document.bgcolor command E.g, document.write("<h1>game over, too many guesses!</h1>"); document.write("the number was "+number); document.bgcolor="red"; 23

24 24 DEBUGGING JAVASCRIPT

25 SCRIPT NOT WORKING? Common places to look for errors Did you spell variables correctly? Is your code in order? Are you trying to use variables before they have a value associated with them American English spelling of words like color Are all semi-colons where they need to be? Use syntax highlighting to find errors Did you concatenate your strings properly? + in the right places Proper use of double quotation marks Using the error console in Firefox to find problems with your script Tools Error Console Tip: clear the error console, then force refresh Errors option will give you information about what line of code has the problem 25

26 26 QUESTIONS?

CMPT 100 : INTRODUCTION TO

CMPT 100 : INTRODUCTION TO CMPT 100 : INTRODUCTION TO COMPUTING TUTORIAL #7 : JAVASCRIPT AND FORM TUTORIAL - CANDY STORE 2 1 By Wendy Sharpe BEFORE WE GET STARTED... Log onto the lab computer (in Windows) Create a folder for this

More information

CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to:

CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to: CS1046 Lab 4 Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to: Define the terms: function, calling and user-defined function and predefined function

More information

Exercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object

Exercise 1 Using Boolean variables, incorporating JavaScript code into your HTML webpage and using the document object CS1046 Lab 5 Timing: This lab should take you approximately 2 hours. Objectives: By the end of this lab you should be able to: Recognize a Boolean variable and identify the two values it can take Calculate

More information

Chapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like?

Chapter 3 - Simple JavaScript - Programming Basics. Lesson 1 - JavaScript: What is it and what does it look like? Chapter 3 - Simple JavaScript - Programming Basics Lesson 1 - JavaScript: What is it and what does it look like? PP presentation JavaScript.ppt. Lab 3.1. Lesson 2 - JavaScript Comments, document.write(),

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

c122mar413.notebook March 06, 2013

c122mar413.notebook March 06, 2013 These are the programs I am going to cover today. 1 2 Javascript is embedded in HTML. The document.write() will write the literal Hello World! to the web page document. Then the alert() puts out a pop

More information

Working with JavaScript

Working 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 information

By the end of this section of the practical, the students should be able to:

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Write JavaScript to generate HTML Create simple scripts which include input and output statements, arithmetic, relational and

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Class Roster Course Web Site & Syllabus JavaScript Introduction (ch. 1) gunkelweb.com/coms469 Introduction to JavaScript Chapter One Introduction to JavaScript and

More information

Introduction to Programming in Turing. Input, Output, and Variables

Introduction to Programming in Turing. Input, Output, and Variables Introduction to Programming in Turing Input, Output, and Variables The IPO Model The most basic model for a computer system is the Input-Processing-Output (IPO) Model. In order to interact with the computer

More information

ITEC136 - Lab 2 Population

ITEC136 - Lab 2 Population ITEC136 - Lab 2 Population Purpose To assess your ability to apply the knowledge and skills developed up though week 7. Emphasis will be placed on the following learning outcomes: 1. Decompose a problem

More information

Variables and Typing

Variables and Typing Variables and Typing Christopher M. Harden Contents 1 The basic workflow 2 2 Variables 3 2.1 Declaring a variable........................ 3 2.2 Assigning to a variable...................... 4 2.3 Other

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

ORB Education Quality Teaching Resources

ORB Education Quality Teaching Resources JavaScript is one of the programming languages that make things happen in a web page. It is a fantastic way for students to get to grips with some of the basics of programming, whilst opening the door

More information

Anatomy of a Function. Pick a Name. Parameters. Definition. Chapter 20: Thinking Big: Programming Functions

Anatomy of a Function. Pick a Name. Parameters. Definition. Chapter 20: Thinking Big: Programming Functions Chapter 20: Thinking Big: Programming Functions Fluency with Information Technology Third Edition by Lawrence Snyder Anatomy of a Function Functions are packages for algorithms 3 parts Name Parameters

More information

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

CMSC 201 Fall 2016 Lab 09 Advanced Debugging CMSC 201 Fall 2016 Lab 09 Advanced Debugging Assignment: Lab 09 Advanced Debugging Due Date: During discussion Value: 10 points Part 1: Introduction to Errors Throughout this semester, we have been working

More information

Part III Appendices 165

Part III Appendices 165 Part III Appendices 165 Appendix A Technical Instructions Learning Outcomes This material will help you learn how to use the software you need to do your work in this course. You won t be tested on it.

More information

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns.

Lab 2 Population. Purpose. Assignment Lab 2 analyzes population growth of a town as well as compare the population growth of two towns. Lab 2 Population Purpose To assess your ability to apply the knowledge and skills developed up though week 7. Emphasis will be placed on the following learning outcomes: 1. Decompose a problem into modularized

More information

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications Hello World! Computer Programming for Kids and Other Beginners by Warren Sande and Carter Sande Chapter 1 Copyright 2009 Manning Publications brief contents Preface xiii Acknowledgments xix About this

More information

COMS 469: Interactive Media II

COMS 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 information

Ph3 Mathematica Homework: Week 1

Ph3 Mathematica Homework: Week 1 Ph3 Mathematica Homework: Week 1 Eric D. Black California Institute of Technology v1.1 1 Obtaining, installing, and starting Mathematica Exercise 1: If you don t already have Mathematica, download it and

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?

More information

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008

More information

PYTHON YEAR 10 RESOURCE. Practical 01: Printing to the Shell KS3. Integrated Development Environment

PYTHON YEAR 10 RESOURCE. Practical 01: Printing to the Shell KS3. Integrated Development Environment Practical 01: Printing to the Shell To program in Python you need the latest version of Python, which is freely available at www.python.org. Your school will have this installed on the computers for you,

More information

CSC Web Programming. Introduction to JavaScript

CSC Web Programming. Introduction to JavaScript CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its

More information

HTML5 and CSS3 More JavaScript Page 1

HTML5 and CSS3 More JavaScript Page 1 HTML5 and CSS3 More JavaScript Page 1 1 HTML5 and CSS3 MORE JAVASCRIPT 3 4 6 7 9 The Math Object The Math object lets the programmer perform built-in mathematical tasks Includes several mathematical methods

More information

Lab 8 CSE 3,Fall 2017

Lab 8 CSE 3,Fall 2017 Lab 8 CSE 3,Fall 2017 In this lab we are going to take what we have learned about both HTML and JavaScript and use it to create an attractive interactive page. Today we will create a web page that lets

More information

C++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh

C++ PROGRAMMING. For Industrial And Electrical Engineering Instructor: Ruba A. Salamh C++ PROGRAMMING For Industrial And Electrical Engineering Instructor: Ruba A. Salamh CHAPTER TWO: Fundamental Data Types Chapter Goals In this chapter, you will learn how to work with numbers and text,

More information

Chapter 2 Working with Data Types and Operators

Chapter 2 Working with Data Types and Operators JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics

More information

BB4W. KS3 Programming Workbook INTRODUCTION TO. BBC BASIC for Windows. Name: Class:

BB4W. KS3 Programming Workbook INTRODUCTION TO. BBC BASIC for Windows. Name: Class: KS3 Programming Workbook INTRODUCTION TO BB4W BBC BASIC for Windows Name: Class: Resource created by Lin White www.coinlea.co.uk This resource may be photocopied for educational purposes Introducing BBC

More information

Section 1. How to use Brackets to develop JavaScript applications

Section 1. How to use Brackets to develop JavaScript applications Section 1 How to use Brackets to develop JavaScript applications This document is a free download from Murach books. It is especially designed for people who are using Murach s JavaScript and jquery, because

More information

var num1 = prompt("enter a number between 1 and 12","1"); var promptstring = "What is " + num1 + " times 3?"; var num2 = prompt(promptstring);

var num1 = prompt(enter a number between 1 and 12,1); var promptstring = What is  + num1 +  times 3?; var num2 = prompt(promptstring); JavaScript Week 2: Last week we learned about the document, which is your html page, and document.write, which is one way in which javascript allows you to write html code to your web page. We also learned

More information

Lesson 3: Basic Programming Concepts

Lesson 3: Basic Programming Concepts 3 ICT Gaming Essentials Lesson 3: Basic Programming Concepts LESSON SKILLS After completing this lesson, you will be able to: Explain the types and uses of variables and operators in game programming.

More information

Decisions, Decisions. Testing, testing C H A P T E R 7

Decisions, 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 information

C++ Support Classes (Data and Variables)

C++ Support Classes (Data and Variables) C++ Support Classes (Data and Variables) School of Mathematics 2018 Today s lecture Topics: Computers and Programs; Syntax and Structure of a Program; Data and Variables; Aims: Understand the idea of programming

More information

introjs.notebook March 02, 2014

introjs.notebook March 02, 2014 1 document.write() uses the write method to write on the document. It writes the literal Hello World! which is enclosed in quotes since it is a literal and then enclosed in the () of the write method.

More information

Iteration and Arrays Dr. Abdallah Mohamed

Iteration and Arrays Dr. Abdallah Mohamed Iteration and Arrays Dr. Abdallah Mohamed Acknowledgement: Original slides provided courtesy of Dr. Lawrence. Before we start: the ++ and -- Operators It is very common to subtract 1 or add 1 from the

More information

An Introduction to Python

An Introduction to Python An Introduction to Python Day 2 Renaud Dessalles dessalles@ucla.edu Python s Data Structures - Lists * Lists can store lots of information. * The data doesn t have to all be the same type! (unlike many

More information

Creating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Creating objects TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Project 2: After Image

Project 2: After Image Project 2: After Image FIT100 Winter 2007 Have you ever stared at an image and noticed that when it disappeared, a shadow of the image was still briefly visible. This is called an after image, and we experiment

More information

Week 1: Introduction to R, part 1

Week 1: Introduction to R, part 1 Week 1: Introduction to R, part 1 Goals Learning how to start with R and RStudio Use the command line Use functions in R Learning the Tools What is R? What is RStudio? Getting started R is a computer program

More information

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with.

Outline. Turtles. Creating objects. Turtles. Turtles in Java 1/27/2011 TOPIC 3 INTRODUCTION TO PROGRAMMING. Making things to program with. 1 Outline 2 TOPIC 3 INTRODUCTION TO PROGRAMMING Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

PIC 40A. Lecture 10: JS: Wrapper objects, Input and Output, Control structures, random numbers. Copyright 2011 Jukka Virtanen UCLA 1 04/24/17

PIC 40A. Lecture 10: JS: Wrapper objects, Input and Output, Control structures, random numbers. Copyright 2011 Jukka Virtanen UCLA 1 04/24/17 PIC 40A Lecture 10: JS: Wrapper objects, Input and Output, Control structures, random numbers 04/24/17 Copyright 2011 Jukka Virtanen UCLA 1 Objects in JS In C++ we have classes, in JS we have OBJECTS.

More information

COSC 122 Computer Fluency. Programming Basics. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Programming Basics. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Programming Basics Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) We will learn JavaScript to write instructions for the computer.

More information

The second statement selects character number 1 from and assigns it to.

The second statement selects character number 1 from and assigns it to. Chapter 8 Strings 8.1 A string is a sequence A string is a sequence of characters. You can access the characters one at a time with the bracket operator: The second statement selects character number 1

More information

Python Intro GIS Week 1. Jake K. Carr

Python Intro GIS Week 1. Jake K. Carr GIS 5222 Week 1 Why Python It s simple and easy to learn It s free - open source! It s cross platform IT S expandable!! Why Python: Example Consider having to convert 1,000 shapefiles into feature classes

More information

COSC 122 Computer Fluency. Iteration and Arrays. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Iteration and Arrays. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Iteration and Arrays Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) A loop repeats a set of statements multiple times until some

More information

Lab 7: OCaml 12:00 PM, Oct 22, 2017

Lab 7: OCaml 12:00 PM, Oct 22, 2017 CS17 Integrated Introduction to Computer Science Hughes Lab 7: OCaml 12:00 PM, Oct 22, 2017 Contents 1 Getting Started in OCaml 1 2 Pervasives Library 2 3 OCaml Basics 3 3.1 OCaml Types........................................

More information

function < name > ( < parameter list > ) { < statements >

function < name > ( < parameter list > ) { < statements > Readings and References Functions INFO/CSE 100, Autumn 2004 Fluency in Information Technology http://www.cs.washington.edu/100 Reading» Fluency with Information Technology Chapter 20, Abstraction and Functions

More information

Python Unit

Python Unit Python Unit 1 1.1 1.3 1.1: OPERATORS, EXPRESSIONS, AND VARIABLES 1.2: STRINGS, FUNCTIONS, CASE SENSITIVITY, ETC. 1.3: OUR FIRST TEXT- BASED GAME Python Section 1 Text Book for Python Module Invent Your

More information

COMP : Practical 6 Buttons and First Script Instructions

COMP : Practical 6 Buttons and First Script Instructions COMP126-2006: Practical 6 Buttons and First Script Instructions In Flash, we are able to create movies. However, the Flash idea of movie is not quite the usual one. A normal movie is (technically) a series

More information

Lab 1. Purpose. Assignment. Action Items/Programming Requirements

Lab 1. Purpose. Assignment. Action Items/Programming Requirements Lab 1 Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 4. Emphasis will be placed on the following learning outcomes: 1. Create and display simple syntactically

More information

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh

Web Programming and Design. MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Web Programming and Design MPT Junior Cycle Tutor: Tamara Demonstrators: Aaron, Marion, Hugh Plan for the next 5 weeks: Introduction to HTML tags, creating our template file Introduction to CSS and style

More information

Arrays Structured data Arrays What is an array?

Arrays Structured data Arrays What is an array? The contents of this Supporting Material document have been prepared from the Eight units of study texts for the course M150: Date, Computing and Information, produced by The Open University, UK. Copyright

More information

Happy Learn JavaScript Tutorial Vol 1

Happy Learn JavaScript Tutorial Vol 1 http://www.happylearnjavascripttutorial.com/ Written and Illustrated by GetContented ( enquiries@getcontented.com.au) Contents 1 How to learn JavaScript enjoyably 1 1.1 Fascination............................

More information

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG

CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday

More information

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,

More information

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)...

2SKILL. Variables Lesson 6. Remembering numbers (and other stuff)... Remembering numbers (and other stuff)... Let s talk about one of the most important things in any programming language. It s called a variable. Don t let the name scare you. What it does is really simple.

More information

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points

CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points CS 1803 Pair Homework 3 Calculator Pair Fun Due: Wednesday, September 15th, before 6 PM Out of 100 points Files to submit: 1. HW3.py This is a PAIR PROGRAMMING Assignment: Work with your partner! For pair

More information

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science)

Lecture 14. Introduction to JavaScript. Mr. Mubashir Ali Lecturer (Dept. of Computer Science) Lecture 14 Introduction to JavaScript Mr. Mubashir Ali Lecturer (Dept. of dr.mubashirali1@gmail.com 1 Outline What is JavaScript? Embedding JavaScript with HTML JavaScript conventions Variables in JavaScript

More information

JavaScript Introduction

JavaScript Introduction JavaScript Introduction What is JavaScript? JavaScript was designed to add interactivity to HTML pages JavaScript is usually embedded directly into HTML pages JavaScript is an interpreted language (means

More information

Lesson 1: Writing Your First JavaScript

Lesson 1: Writing Your First JavaScript JavaScript 101 1-1 Lesson 1: Writing Your First JavaScript OBJECTIVES: In this lesson you will be taught how to Use the tag Insert JavaScript code in a Web page Hide your JavaScript

More information

Lab 3 - Pizza. Purpose. Assignment

Lab 3 - Pizza. Purpose. Assignment Lab 3 - Pizza Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 9. Emphasis will be placed on the following learning outcomes: 1. Create syntactically correct

More information

Client Side JavaScript and AJAX

Client Side JavaScript and AJAX Client Side JavaScript and AJAX Client side javascript is JavaScript that runs in the browsers of people using your site. So far all the JavaScript code we've written runs on our node.js server. This is

More information

1) Log on to the computer using your PU net ID and password.

1) Log on to the computer using your PU net ID and password. CS 150 Lab Logging on: 1) Log on to the computer using your PU net ID and password. Connecting to Winter: Winter is the computer science server where all your work will be stored. Remember, after you log

More information

Eclipse Environment Setup

Eclipse Environment Setup Eclipse Environment Setup Adapted from a document from Jeffrey Miller and the CS201 team by Shiyuan Sheng. Introduction This lab document will go over the steps to install and set up Eclipse, which is

More information

CSCI 201 Lab 1 Environment Setup

CSCI 201 Lab 1 Environment Setup CSCI 201 Lab 1 Environment Setup "The journey of a thousand miles begins with one step." - Lao Tzu Introduction This lab document will go over the steps to install and set up Eclipse, which is a Java integrated

More information

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet. Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

More information

CMSC 201 Computer Science I for Majors

CMSC 201 Computer Science I for Majors CMSC 201 Computer Science I for Majors Lecture 02 Intro to Python Syllabus Last Class We Covered Grading scheme Academic Integrity Policy (Collaboration Policy) Getting Help Office hours Programming Mindset

More information

Unit E Step-by-Step: Programming with Python

Unit E Step-by-Step: Programming with Python Unit E Step-by-Step: Programming with Python Computer Concepts 2016 ENHANCED EDITION 1 Unit Contents Section A: Hello World! Python Style Section B: The Wacky Word Game Section C: Build Your Own Calculator

More information

A340 Laboratory Session #5

A340 Laboratory Session #5 A340 Laboratory Session #5 LAB GOALS Creating multiplication table using JavaScript Creating Random numbers using the Math object Using your text editor (Notepad++ / TextWrangler) create a web page similar

More information

S A M P L E C H A P T E R

S A M P L E C H A P T E R SAMPLE CHAPTER Get Programming with JavaScript by John R. Larsen Chapter 12 Copyright 2016 Manning Publications brief contents PART 1 CORE CONCEPTS ON THE CONSOLE...1 1 Programming, JavaScript, and JS

More information

Coding in JavaScript functions

Coding in JavaScript functions Coding in JavaScript functions A function contains code that will be executed by an event or by a call to the function. You may call a function from anywhere within a page (or even from other pages if

More information

Introduction to C Programming. What is a C program?

Introduction to C Programming. What is a C program? Introduction to C Programming Goals of this section Write a simple C program - Steps Write or develop code Compile Link Execute Add comments to C code 85-132 Introduction to C-Programming 2-1 What is a

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

Excel 2010 Functions. 4/18/2011 Archdiocese of Chicago Mike Riley

Excel 2010 Functions. 4/18/2011 Archdiocese of Chicago Mike Riley Excel 2010 Functions 4/18/2011 Archdiocese of Chicago Mike Riley i VIDEO TUTORIALS AVAILABLE Almost 100,000 video tutorials are available from VTC. The available tutorials include Windows 7, GroupWise

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Class #1. introduction, functions, variables, conditionals

Class #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 information

Getting Started with the FTC SDK. Jaxon Brown August 5, 2017

Getting Started with the FTC SDK. Jaxon Brown August 5, 2017 Getting Started with the FTC SDK Jaxon Brown August 5, 2017 Goals Install the Software Development Kit (SDK) Learn the Java basics How is the FTC SDK structured? Creating a basic Teleop Program Creating

More information

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++

Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ Laboratory 0 Week 0 Advanced Structured Programming An Introduction to Visual Studio and C++ 0.1 Introduction This is a session to familiarize working with the Visual Studio development environment. It

More information

C# Programming Tutorial Lesson 1: Introduction to Programming

C# Programming Tutorial Lesson 1: Introduction to Programming C# Programming Tutorial Lesson 1: Introduction to Programming About this tutorial This tutorial will teach you the basics of programming and the basics of the C# programming language. If you are an absolute

More information

How to Open a Free Yahoo! Account & Basics

How to Open a Free Yahoo!  Account &  Basics How to Open a Free Yahoo! Email Account & Email Basics Opening a Yahoo! Email Account Yahoo! Email is one of the many types of free email systems out there. This tutorial will teach you how to set up a

More information

Programming Fundamentals and Python

Programming Fundamentals and Python Chapter 2 Programming Fundamentals and Python This chapter provides a non-technical overview of Python and will cover the basic programming knowledge needed for the rest of the chapters in Part 1. It contains

More information

Lab 1 Concert Ticket Calculator

Lab 1 Concert Ticket Calculator Lab 1 Concert Ticket Calculator Purpose To assess your ability to apply the knowledge and skills developed in weeks 1 through 3. Emphasis will be placed on the following learning outcomes: 1. Create and

More information

AUTOMATOR REFERENCE MANUAL

AUTOMATOR REFERENCE MANUAL AUTOMATOR REFERENCE MANUAL Improvision, Viscount Centre II, University of Warwick Science Park, Millburn Hill Road, Coventry, CV4 7HS Tel: +44 (0) 24 7669 2229 Fax: +44 (0) 24 7669 0091 e-mail: admin@improvision.com

More information

CISC 110 Week 3. Expressions, Statements, Programming Style, and Test Review

CISC 110 Week 3. Expressions, Statements, Programming Style, and Test Review CISC 110 Week 3 Expressions, Statements, Programming Style, and Test Review Today Review last week Expressions/Statements Programming Style Reading/writing IO Test review! Trace Statements Purpose is to

More information

INTRODUCTION TO JAVASCRIPT

INTRODUCTION TO JAVASCRIPT INTRODUCTION TO JAVASCRIPT Overview This course is designed to accommodate website designers who have some experience in building web pages. Lessons familiarize students with the ins and outs of basic

More information

Compilation and Execution Simplifying Fractions. Loops If Statements. Variables Operations Using Functions Errors

Compilation and Execution Simplifying Fractions. Loops If Statements. Variables Operations Using Functions Errors First Program Compilation and Execution Simplifying Fractions Loops If Statements Variables Operations Using Functions Errors C++ programs consist of a series of instructions written in using the C++ syntax

More information

Your First Windows Form

Your First Windows Form Your First Windows Form From now on, we re going to be creating Windows Forms Applications, rather than Console Applications. Windows Forms Applications make use of something called a Form. The Form is

More information

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something

Software. Programming Languages. Types of Software. Types of Languages. Types of Programming. Software does something Software Software does something LBSC 690: Week 10 Programming, JavaScript Jimmy Lin College of Information Studies University of Maryland Monday, April 9, 2007 Tells the machine how to operate on some

More information

Programming Paradigms

Programming Paradigms PP 2017/18 Unit 11 Functional Programming with Haskell 1/37 Programming Paradigms Unit 11 Functional Programming with Haskell J. Gamper Free University of Bozen-Bolzano Faculty of Computer Science IDSE

More information

Java Programming Fundamentals - Day Instructor: Jason Yoon Website:

Java Programming Fundamentals - Day Instructor: Jason Yoon Website: Java Programming Fundamentals - Day 1 07.09.2016 Instructor: Jason Yoon Website: http://mryoon.weebly.com Quick Advice Before We Get Started Java is not the same as javascript! Don t get them confused

More information

CSCE 120: Learning To Code

CSCE 120: Learning To Code CSCE 120: Learning To Code Manipulating Data I Introduction This module is designed to get you started working with data by understanding and using variables and data types in JavaScript. It will also

More information

IAT 445 Lab 10. Special Topics in Unity. Lanz Singbeil

IAT 445 Lab 10. Special Topics in Unity. Lanz Singbeil IAT 445 Lab 10 Special Topics in Unity Special Topics in Unity We ll be briefly going over the following concepts. They are covered in more detail in your Watkins textbook: Setting up Fog Effects and a

More information

Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F

Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F PROGRAM 4A Full Names (25 points) Honors Computer Science Python Mr. Clausen Programs 4A, 4B, 4C, 4D, 4E, 4F This program should ask the user for their full name: first name, a space, middle name, a space,

More information

Like most objects, String objects need to be created before they can be used. To create a String object, we can write

Like most objects, String objects need to be created before they can be used. To create a String object, we can write JavaScript Native Objects Broswer Objects JavaScript Native Objects So far we have just been looking at what objects are, how to create them, and how to use them. Now, let's take a look at some of the

More information

A.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies

A.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies Internet t Software Technologies JavaScript part one IMCNE A.A. 2008/09 Gabriele Cecchetti Why introduce JavaScript To add dynamicity and interactivity to HTML pages 2 What s a script It s a little interpreted

More information

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/

CS61C Machine Structures. Lecture 4 C Pointers and Arrays. 1/25/2006 John Wawrzynek. www-inst.eecs.berkeley.edu/~cs61c/ CS61C Machine Structures Lecture 4 C Pointers and Arrays 1/25/2006 John Wawrzynek (www.cs.berkeley.edu/~johnw) www-inst.eecs.berkeley.edu/~cs61c/ CS 61C L04 C Pointers (1) Common C Error There is a difference

More information

Entry Point of Execution: the main Method. Elementary Programming. Compile Time vs. Run Time. Learning Outcomes

Entry Point of Execution: the main Method. Elementary Programming. Compile Time vs. Run Time. Learning Outcomes Entry Point of Execution: the main Method Elementary Programming EECS2030: Advanced Object Oriented Programming Fall 2017 CHEN-WEI WANG For now, all your programming exercises will be defined within the

More information

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING

7/8/10 KEY CONCEPTS. Problem COMP 10 EXPLORING COMPUTER SCIENCE. Algorithm. Lecture 2 Variables, Types, and Programs. Program PROBLEM SOLVING KEY CONCEPTS COMP 10 EXPLORING COMPUTER SCIENCE Lecture 2 Variables, Types, and Programs Problem Definition of task to be performed (by a computer) Algorithm A particular sequence of steps that will solve

More information