HTML5 and CSS3 More JavaScript Page 1
|
|
- Audra Clark
- 6 years ago
- Views:
Transcription
1 HTML5 and CSS3 More JavaScript Page 1 1 HTML5 and CSS3 MORE JAVASCRIPT The Math Object The Math object lets the programmer perform built-in mathematical tasks Includes several mathematical methods Math.min() Math.max() Math.pow() Math.round() Math.random() Constants of the Math Object // Finds smallest number in a list // Finds largest number in a list // Calculates the power of a number // Round to an integer // Returns a random number A constant is an identifier (like a variable) whose value once assigned never changes Some built-in constants of the Math object are: Math.PI Math.E The Date Object The Date object has several constructors for instantiating objects that store dates and times var dateobject = new Date(year, month, date); The date specified as arguments var dateobject = new Date(year, month, date, hour, minutes, seconds); The date and time specified as arguments var dateobject = new Date(); The current system date and time Some Methods of the Date Object Some methods of the date object are: dateobject.getfullyear() dateobject.getmonth() dateobject.getday() dateobject.gethours() dateobject.tostring() dateobject.toutcstring() dateobject.getlocaledatestring() dateobject.getlocaletimestring () Escape Sequences // Number of day of week // Local time // GMT Characters within a string followed by the backslash (\) character have a special meaning \b Backspace
2 HTML5 and CSS3 More JavaScript Page 2 \nnewline \t Vertical tab \" (For placing a quote inside a string) \\ (For placing a backslash inside a string) \uxxxx (Returns hex Unicode character) Type Conversions JavaScript is flexible with data types Automatically converts data type of variable to the type of the variable that is assigned to it Will attempt to convert factors in an expression based upon the operator 17 + "hello"; // Concatenates number and string "24" / "3"; "7" * "n"; Predefined Global Variables // Converts both strings and divides // Cannot convert "n" to a number // cannot multiply, returns NaN JavaScript read-only variables that usually are the result of some error in processing NaN (not a number) Infinity null (primitives, e.g. integers and floats, not assigned a value or an object not yet instantiated) undefined (value of variables not yet initialized deeper kind of absence than null) Wrapper Objects Used to force an explicit data type conversion onto a variable E.g. String(), Number(), Boolean(), etc. Almost never necessary in JavaScript Examples: var a = String(23.4); var b = Number("23.4"); var c = Boolean("true"); The getitembyid() Method Page 1 The document.getelementbyid() method returns any element in the DOM that has the ID attribute with the specified value Not just the value of an input text box Used almost every time the developer wants to manipulate or get information from an element on the document Returns null if no elements with the specified ID exists The ID should be unique within the web document If more than one element with the specified ID exists, returns the first element in the source code
3 HTML5 and CSS3 More JavaScript Page 3 16 The getitembyid() Method Page 2 document.getelementbyid("elementid") The elementid is the ID attribute value of any element in the document The getitembyid() Method Page 3 Examples: var number = document.getelementbyid("number").value; Retrieves (gets) the current value from an element with ID = "number" (could be any <form> element) document.getelementbyid("resultbinary").value = "10110"; Updates (sets) the value of an element with ID = "resultbinary" The innerhtml Property Page 1 The innerhtml property updates (sets) or returns (gets) the HTML content of an element Can be a combination of text and HTML tags There is a rarely used innertext property that can be used to update (set) and return (get) text only HTMLElementObject.innerHTML The HTMLElementObject is an element in the DOM (might be identified by ID or some other attribute) The innerhtml Property Page 2 Examples: document.getelementbyid("resultbinary").innerhtml = "10110"; Updates (sets) the HTML content of an element with ID = "resultbinary" var number = document.getelementbyid("number").value; Retrieves (gets) the current HTML content from an element with ID = "number" The tostring() Method The tostring() method converts a number to a string displayed in a specific base E.g. binary, octal, hexadecimal, etc. Convert to binary numb.tostring(2) Convert to hexadecimal numb.tostring(16) Parse Methods Page 1 The parse methods (parseint and parsefloat) methods take string arguments and parse (e.g. convert) them to int s and float s respectively Formats:
4 HTML5 and CSS3 More JavaScript Page 4 parseint(string) parsefloat(string) The string is the string that contains the number that is to be parsed Parse Methods Page 2 Both the first and second examples below will execute identically and return the integer 123: var number = parseint("123"); var number = parseint("123abc4"); In the second instance the JavaScript engine assumes there are no more numbers when it gets to the letter a Conditional Statements Provides alternative execution paths One path or another is chosen when the program executes depending upon a Boolean test result Either True or False the only two truth values Both selection (decision) and iteration (repetition/loop) structures use conditional statements The Relation Condition Page 1 A booleanexpression that compares two factors for conditions that are: Equal to (or not equal to) Greater than (or equal to) Less than (or equal to) The Relation Condition Page 2 factor1 relationaloperator factor2 At least one factor must be a variable both may be Examples: salary >= 150 hours == noon Relational Operators Also sometimes called conditional operators: == Is equal to < Is less than > Is greater than <= Is less than or equal (identical) to >= Is greater than or equal (identical) to!= Is not equal to Single-Sided if Statement Page 1
5 HTML5 and CSS3 More JavaScript Page 5 Statement(s) executed only if the test is true If the condition is false, statement(s) in body of structure are skipped if (booleanexpression) statement(s) to be executed when the test succeeds go here; Single-Sided if Statement Page 2 1. The keyword if 2. The booleanexpression inside (parentheses) 3. Statement(s) to be executed if booleanexpression is true in braces Single-Sided if Statement Page 3 var richpoor = "poor"; if (salary >= 150) richpoor = "rich"; Semi-colon (;) placement after every statement in the body of the structure (not after the condition) Single-Sided if Statement Page 4 Alternates if only one statement to be executed (braces not necessary) Alternate example 1: if (salary >= 150) richpoor = "rich"; Alternate example 2 (on a single line): if (salary >= 150) richpoor = "rich"; Double-Sided if Statement Page 1 One (set of) statement(s) executed if the test evaluates as true Another (set of) statement(s) executed if the test is false Double-Sided if Statement Page 2 if (booleanexpression) statement(s) to be executed when the test succeeds go here;
6 HTML5 and CSS3 More JavaScript Page 6 else statement(s) to be executed when the test fails go here; Double-Sided if Statement Page 3 1. The keyword if 2. The booleanexpression inside (parentheses) 3. Statement(s) to be executed if booleanexpression is true in the first set of braces 4. The keyword else 5. The statement(s) to be executed if the test fails in the second set of braces Double-Sided if Statement Page 4 if (salary >= 150) document.write("you must be rich"); else // if salary < 150 document.write("you must be poor"); Double-Sided if Statement (Page 5) Example (alternate version with no braces): if (salary >= 150) document.write("you must be rich"); else // if salary < 150 document.write("you must be poor"); Valid usage without braces because there is only one statement for each truth value Statement if true goes after the condition Statement if false goes after the keyword else Double-Sided if Statement (Page 6) Example (another alternate version): if (salary >= 150) document.write("you must be rich"); else document.write("you must be poor"); // salary < 150 Code Blocks Page 1 A set of statements inside braces More than one statement may executed within either true or false test block
7 HTML5 and CSS3 More JavaScript Page 7 if (booleanexpression) statement1; statement2; [statement3; ] Code Blocks Page 2 if (mousex > 100) fill(255); background(0); The else if Structure The if statement only can test for two truth values in an individual statement An option available for this purpose is the linear nested if It can test for more than two values (or ranges of values) of same variable within the structure The key words else if provide for an unlimited number of boolean expressions Sometimes known as case selection Format of else if if (booleanexpression1) statement(s) to be executed when test 1 succeeds go here; else if (booleanexpression2) statement(s) to be executed when test 2 succeeds go here; [else if ] [else statement(s) to be executed when all tests fail go here; ]
8 HTML5 and CSS3 More JavaScript Page 8 49 Example of else if Page 1 if (error.code == error.permission) alert("not sharing your location"); else if (error.code == error.position_unavailable) alert("cannot detect position"); Example of else if Page 2 else if (error.code == error.time_out) alert("position retrieval timed out"); else // if (error.code == error.unknown_error) alert("unknown error"); Combined if Statements Page 1 A combined (also called compound) if statement contains Multiple Boolean expressions (more than one) Connected by the logical operators && (meaning AND) (meaning OR) Combined if Statements Page 2 Formats: if (booleanexpression1 && booleanexpression2) or if (booleanexpression3 booleanexpression4) Combined if Statements Page 3 Examples: if (age >= 0 && age <= 10) With the && (AND) operator all conditions must be true if (age <= 10 age >= 80) With the (OR) operator any one condition (or more conditions) must be true
9 HTML5 and CSS3 More JavaScript Page 9 55 The! (NOT) Logical Operator Used to negate a Boolean expression so that the inverse (opposite) of the condition is true! booleanexpression The booleanexpression could be a Boolean variable, Boolean function or a relation condition if (! (age >= 0 && age <= 10) ) Is equivalent to: if (age < 0 age > 10) The switch Statement Page 1 The switch statement is used to select from one of a series of code blocks The switch expression is evaluated once The value of the expression is compared with the values of each case looking for a match (an equal to value) If there is a match between the expression and one case, the associated code block is executed The switch Statement Page 2 The keyword break breaks out of the switch block Stops execution of more code and additional case testing inside the block The job is done once one case matches the expression The default case is optional The switch Statement Page 3 switch(expression) case value: statements executed if value matches break; case value: statements executed if value matches break; default: statements executed if all cases false 60 The switch Statement Page 4
10 HTML5 and CSS3 More JavaScript Page 10 switch ( new Date().getDay() ) case 6: result = "Today is Saturday"; break; case 0: result = "Today is Sunday"; break; default: result = "Looking forward to weekend"; 61 The switch Statement Page 5 Equivalent to: var day = new Date().getDay(); if (day == 6) result = "Today is Saturday"; else if (day == 0) result = "Today is Sunday"; else result = "Looking forward to weekend"; Iteration (Loop) Statements Provides repeated execution of a block of statements The loop continues: A specified number of times (counter-controlled looping) While a condition is met (sentinel-controlled looping) or Also called repetition or do while structure Meaning do the loop while condition is True The for Loop Page 1 Implements a loop by counting a specific number of iterations (repetitions) Counter-controlled looping Appropriate when the exact number of loop repetitions is known for (initialize; booleanexpression; increment) statement(s) to be repeated; The for Loop Page 2
11 HTML5 and CSS3 More JavaScript Page 11 Example (three expressions in the parentheses): for (var ctr = 1; ctr <= 10; ctr++) The initialize component (var ctr = 1) Value assigned to a counter variable when the loop is first encountered in the program The booleanexpression component (ctr <= 10) Relation condition which is tested to determine if the loop should be entered again The increment component (ctr++) Indicates by what value the counter changes at the beginning of each subsequent loop The for Loop Page 3 Example 1: for (var ctr = 1; ctr <= stars; ctr++) document.write("*"); Unary Operators Unary operators update variables values by adding (increment operator) or subtracting (decrement operator) value of 1 to (or from) Operator Example Explanation ++ ctr++; ctr = ctr + 1; ++ ++ctr; ctr = ctr + 1; -- ctr--; ctr = ctr 1; -- --ctr; ctr = ctr 1; The for Loop Page 4 Example 2: var fahrenheit = [212, 72, 32, 0, -444]; var centigrade; for (var index = 0; index < 4; index++) centigrade = 5 / 9 * (fahrenheit[index] 32); document.write(centigrade); 70 Array Initializers An array initializer is an array literal in square [brackets], e.g.: [] is an empty array with no elements [3, 7] is an array with two elements [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] is a 3 x 3 2-dimensional array
12 HTML5 and CSS3 More JavaScript Page 12 [1,,,, 5] is an array with five elements in which three of the elements are undefined The for in Statement Page 1 Enables looping through an array without knowing exact number of elements During each loop execution the index for the array element is assigned to the for in variable for (var index in arrayname) statement(s) The for in Statement Page 2 var fahrenheit = [212, 72, 32, 0, -444]; var centigrade; for (var index in fahrenheit) centigrade = 5 / 9 * (fahrenheit[index] 32); document.write(centigrade); 74 The for in Statement Page 3 Equivalent to: var fahrenheit = [212, 72, 32, 0, -444]; var centigrade; for (var index = 0; index < 4; index++) centigrade = 5 / 9 * (fahrenheit[index] 32); document.write(centigrade); The while Loop Page 1 Continues to repeat a loop as long as a controlling condition is true (pre-test) Sentinel-controlled looping The variable controlling the condition must be updated by logic within the loop Exact number of loops is usually unknown The while Loop Page 2 while (booleanexpression)
13 HTML5 and CSS3 More JavaScript Page 13 statement(s) to be repeated as long as the booleanexpression is true; 78 The while Loop Page 3 var balance = ; var rate =.08; while (balance < ) balance *= (1 + rate); year++; 80 Assignment Operators Also known as op equals operators Assigns an updated value to a variable Operator Example Explanation += ctr += 1; ctr = ctr + 1; -= ctr -= 17; ctr = ctr - 17; *= ctr *= 8; ctr = ctr * 8; /= ctr /= 5; ctr = ctr / 5;
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 informationClient-Side Web Technologies. JavaScript Part I
Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA
More informationPrincess 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 informationJavaScript I Language Basics
JavaScript I Language Basics Chesapeake Node.js User Group (CNUG) https://www.meetup.com/chesapeake-region-nodejs-developers-group START BUILDING: CALLFORCODE.ORG Agenda Introduction to JavaScript Language
More informationCOMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts
COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationOverview: Programming Concepts. Programming Concepts. Names, Values, And Variables
Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating
More informationOverview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript
Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating
More informationLanguage Fundamentals Summary
Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de
More informationOperators. Java operators are classified into three categories:
Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.
More informationCoding 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 informationSuch JavaScript Very Wow
Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written
More informationA.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 informationCOMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts
COMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationegrapher Language Reference Manual
egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics
Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationCGS 3066: Spring 2015 JavaScript Reference
CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within
More informationFull file at
Java Programming, Fifth Edition 2-1 Chapter 2 Using Data within a Program At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationBasics of Java Programming
Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement
More informationContents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual
Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9
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 informationJavaScript: The Basics
JavaScript: The Basics CISC 282 October 4, 2017 JavaScript A programming language "Lightweight" and versatile Not universally respected Appreciated in the web domain Adds programmatic functionality to
More informationTED Language Reference Manual
1 TED Language Reference Manual Theodore Ahlfeld(twa2108), Konstantin Itskov(koi2104) Matthew Haigh(mlh2196), Gideon Mendels(gm2597) Preface 1. Lexical Elements 1.1 Identifiers 1.2 Keywords 1.3 Constants
More informationArrays 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 informationThe Warhol Language Reference Manual
The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming
More informationJavaScript Basics. The Big Picture
JavaScript Basics At this point, you should have reached a certain comfort level with typing and running JavaScript code assuming, of course, that someone has already written it for you This handout aims
More informationJAVA Programming Fundamentals
Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol
More informationJAVASCRIPT BASICS. Type-Conversion in JavaScript. Type conversion or typecasting is one of the very important concept in
Type-Conversion in JavaScript Description Type conversion or typecasting is one of the very important concept in JavaScript. It refers to changing an entity or variable from one datatype to another. There
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationCHAPTER 5: JavaScript Basics 99
CHAPTER 5: JavaScript Basics 99 5.2 JavaScript Keywords, Variables, and Operators 5.2.1 JavaScript Keywords break case continue default delete do else export false for function if import in new null return
More information3 The Building Blocks: Data Types, Literals, and Variables
chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating
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 informationVisual C# Instructor s Manual Table of Contents
Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms
More informationUNIT - I. Introduction to C Programming. BY A. Vijay Bharath
UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been
More informationJavaScript CS 4640 Programming Languages for Web Applications
JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation
More informationJME Language Reference Manual
JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationJava Basic Datatypees
Basic Datatypees Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory. Based on the data type of a variable,
More informationwrite vs. writeln Prompting as Page Loads Today s Goals CSCI 2910 Client/Server-Side Programming Intermediate File vs. HTML Output
CSCI 2910 Client/Server-Side Programming Topic: JavaScript Part 2 Today s Goals Today s lecture will cover: More objects, properties, and methods of the DOM The Math object Introduction to form validation
More informationTypes and Expressions. Chapter 3
Types and Expressions Chapter 3 Chapter Contents 3.1 Introductory Example: Einstein's Equation 3.2 Primitive Types and Reference Types 3.3 Numeric Types and Expressions 3.4 Assignment Expressions 3.5 Java's
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 informationIntroduction to Visual Basic and Visual C++ Arithmetic Expression. Arithmetic Expression. Using Arithmetic Expression. Lesson 4.
Introduction to Visual Basic and Visual C++ Arithmetic Expression Lesson 4 Calculation I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Arithmetic Expression Using Arithmetic Expression Calculations
More informationWhat is PHP? [1] Figure 1 [1]
PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure
More informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationBigFix Inspector Library
BigFix Inspector Library Core Inspectors Compatible with BES 8.0 November 23, 2010 2010 BigFix, Inc. All rights reserved. BigFix, Fixlet, Relevance Engine, Powered by BigFix and related BigFix logos are
More information4 Programming Fundamentals. Introduction to Programming 1 1
4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,
More informationLecture 3. More About C
Copyright 1996 David R. Hanson Computer Science 126, Fall 1996 3-1 Lecture 3. More About C Programming languages have their lingo Programming language Types are categories of values int, float, char Constants
More informationhttps://asd-pa.perfplusk12.com/admin/admin_curric_maps_display.aspx?m=5507&c=618&mo=18917&t=191&sy=2012&bl...
Page 1 of 13 Units: - All - Teacher: ProgIIIJavaI, CORE Course: ProgIIIJavaI Year: 2012-13 Intro to Java How is data stored by a computer system? What does a compiler do? What are the advantages of using
More informationCrayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)
Crayon (.cry) Language Reference Manual Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361) 1 Lexical Elements 1.1 Identifiers Identifiers are strings used
More informationPrimitive Data Types: Intro
Primitive Data Types: Intro Primitive data types represent single values and are built into a language Java primitive numeric data types: 1. Integral types (a) byte (b) int (c) short (d) long 2. Real types
More informationKey Concept: all programs can be broken down to a combination of one of the six instructions Assignment Statements can create variables to represent
Programming 2 Key Concept: all programs can be broken down to a combination of one of the six instructions Assignment Statements can create variables to represent information Input can receive information
More informationChapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 2 C++ Basics 1 Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Slide 2-3 2.1 Variables and Assignments 2
More informationLanguage Reference Manual simplicity
Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna
More informationChapter 3 Data Types and Variables
Chapter 3 Data Types and Variables Adapted from JavaScript: The Complete Reference 2 nd Edition by Thomas Powell & Fritz Schneider 2004 Thomas Powell, Fritz Schneider, McGraw-Hill Jargon Review Variable
More informationCSC Java Programming, Fall Java Data Types and Control Constructs
CSC 243 - Java Programming, Fall 2016 Java Data Types and Control Constructs Java Types In general, a type is collection of possible values Main categories of Java types: Primitive/built-in Object/Reference
More informationChapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:
Java Programming, Eighth Edition 2-1 Chapter 2 Using Data A Guide to this Instructor s Manual: We have designed this Instructor s Manual to supplement and enhance your teaching experience through classroom
More informationUNIT- 3 Introduction to C++
UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . $, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage
More informationINFS 2150 Introduction to Web Development and e-commerce Technology. Programming with JavaScript
INFS 2150 Introduction to Web Development and e-commerce Technology Programming with JavaScript 1 Objectives JavaScript client-side programming Example of a JavaScript program The element
More informationObjectives. Introduction to JavaScript. Introduction to JavaScript INFS Peter Y. Wu, RMU 1
Objectives INFS 2150 Introduction to Web Development and e-commerce Technology Programming with JavaScript JavaScript client-side programming Example of a JavaScript program The element
More informationAnnouncements. Lab Friday, 1-2:30 and 3-4:30 in Boot your laptop and start Forte, if you brought your laptop
Announcements Lab Friday, 1-2:30 and 3-4:30 in 26-152 Boot your laptop and start Forte, if you brought your laptop Create an empty file called Lecture4 and create an empty main() method in a class: 1.00
More informationThe JavaScript Language
The JavaScript Language INTRODUCTION, CORE JAVASCRIPT Laura Farinetti - DAUIN What and why JavaScript? JavaScript is a lightweight, interpreted programming language with object-oriented capabilities primarily
More informationIntroduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1
Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables
More informationJAVASCRIPT. sarojpandey.com.np/iroz. JavaScript
JAVASCRIPT 1 Introduction JAVASCRIPT is a compact, object-based scripting language for developing client Internet applications. was designed to add interactivity to HTML pages. is a scripting language
More informationChapter 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 informationc) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.
2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C
More informationJava Overview An introduction to the Java Programming Language
Java Overview An introduction to the Java Programming Language Produced by: Eamonn de Leastar (edeleastar@wit.ie) Dr. Siobhan Drohan (sdrohan@wit.ie) Department of Computing and Mathematics http://www.wit.ie/
More informationHUDSONVILLE HIGH SCHOOL COURSE FRAMEWORK
HUDSONVILLE HIGH SCHOOL COURSE FRAMEWORK COURSE / SUBJECT Introduction to Programming KEY COURSE OBJECTIVES/ENDURING UNDERSTANDINGS OVERARCHING/ESSENTIAL SKILLS OR QUESTIONS Introduction to Java Java Essentials
More informationWhat did we talk about last time? Examples switch statements
Week 4 - Friday What did we talk about last time? Examples switch statements History of computers Hardware Software development Basic Java syntax Output with System.out.print() Mechanical Calculation
More informationCSI33 Data Structures
Outline Department of Mathematics and Computer Science Bronx Community College October 24, 2018 Outline Outline 1 Chapter 8: A C++ Introduction For Python Programmers Expressions and Operator Precedence
More informationWeek 6: Review. Java is Case Sensitive
Week 6: Review Java Language Elements: special characters, reserved keywords, variables, operators & expressions, syntax, objects, scoping, Robot world 7 will be used on the midterm. Java is Case Sensitive
More informationChapter 2. C++ Basics. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 2 C++ Basics Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style 3 2.1 Variables and Assignments Variables and
More informationChapter 2. C++ Basics
Chapter 2 C++ Basics Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Slide 2-2 2.1 Variables and Assignments Variables
More informationInformation Science 1
Information Science 1 Simple Calcula,ons Week 09 College of Information Science and Engineering Ritsumeikan University Topics covered l Terms and concepts from Week 8 l Simple calculations Documenting
More informationChapter Overview. C++ Basics. Variables and Assignments. Variables and Assignments. Keywords. Identifiers. 2.1 Variables and Assignments
Chapter 2 C++ Basics Overview 2.1 Variables and Assignments 2.2 Input and Output 2.3 Data Types and Expressions 2.4 Simple Flow of Control 2.5 Program Style Copyright 2011 Pearson Addison-Wesley. All rights
More informationInternet & World Wide Web How to Program, 5/e by Pearson Education, Inc. All Rights Reserved.
Internet & World Wide Web How to Program, 5/e Sequential execution Execute statements in the order they appear in the code Transfer of control Changing the order in which statements execute All scripts
More informationAssoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.
Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All for repetition statement do while repetition statement switch multiple-selection statement break statement continue statement Logical
More informationChapter 2 Elementary Programming
Chapter 2 Elementary Programming Part I 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical
More informationLanguage Reference Manual
Programming Languages and Translators Language Reference Manual ART: Animation Rendering Tool Brett Jervey - baj2125 Gedion Metaferia - gym2103 Natan Kibret - nfk2105 Soul Joshi - srj2120 October 26, 2016
More informationChapter 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 informationImportant Java terminology
1 Important Java terminology The information we manage in a Java program is either represented as primitive data or as objects. Primitive data פרימיטיביים) (נתונים include common, fundamental values as
More informationQUIZ: What value is stored in a after this
QUIZ: What value is stored in a after this statement is executed? Why? a = 23/7; QUIZ evaluates to 16. Lesson 4 Statements, Expressions, Operators Statement = complete instruction that directs the computer
More information\n is used in a string to indicate the newline character. An expression produces data. The simplest expression
Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of
More informationCOMS W4115 Programming Languages & Translators GIRAPHE. Language Reference Manual
COMS W4115 Programming Languages & Translators GIRAPHE Language Reference Manual Name UNI Dianya Jiang dj2459 Vince Pallone vgp2105 Minh Truong mt3077 Tongyun Wu tw2568 Yoki Yuan yy2738 1 Lexical Elements
More informationJAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)
Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 1 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) WHO
More informationDecaf Language Reference Manual
Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented
More informationChapter 2: Functions and Control Structures
Chapter 2: Functions and Control Structures TRUE/FALSE 1. A function definition contains the lines of code that make up a function. T PTS: 1 REF: 75 2. Functions are placed within parentheses that follow
More informationLexical Considerations
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler
More informationWEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS
WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS OPERATORS Review: Data values can appear as literals or be stored in variables/constants Data values can be returned by method calls Operators: special symbols
More informationCMPT 100 : INTRODUCTION TO
CMPT 100 : INTRODUCTION TO COMPUTING TUTORIAL #5 : JAVASCRIPT 2 GUESSING GAME 1 By Wendy Sharpe BEFORE WE GET STARTED... If you have not been to the first tutorial introduction JavaScript then you must
More informationC++ Basics. Lecture 2 COP 3014 Spring January 8, 2018
C++ Basics Lecture 2 COP 3014 Spring 2018 January 8, 2018 Structure of a C++ Program Sequence of statements, typically grouped into functions. function: a subprogram. a section of a program performing
More informationServer side basics CS380
1 Server side basics URLs and web servers 2 http://server/path/file Usually when you type a URL in your browser: Your computer looks up the server's IP address using DNS Your browser connects to that IP
More information1007 Imperative Programming Part II
Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be
More informationRTL Reference 1. JVM. 2. Lexical Conventions
RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's
More informationJava Notes. 10th ICSE. Saravanan Ganesh
Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationJava provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:
JAVA OPERATORS GENERAL Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators
More information