Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to Computer Programming

Similar presentations


Presentation on theme: "Introduction to Computer Programming"— Presentation transcript:

1 Introduction to Computer Programming
CS 126 Lecture 3 Zeke Maier

2 Plan for Today Questions Administrivia Data Types and Expressions
Assignment

3 Questions Steve Jobs Products? Macworld Health? iPod iPhone iTunes
MacBook Macworld iTunes Store selling DRM free music Weight Loss, Hormone Imbalance, More Complex…, 6 month leave of absence, Cancer? Steven Paul Jobs 1955, is the American co-founder, Chairman, and CEO of Apple Inc. and the former CEO of Pixar Animation Studios. In the late 1970s, Jobs, with Apple co-founder Steve Wozniak, created one of the first commercially successful personal computers. In the early 1980s, Jobs was among the first to see the commercial potential of the mouse-driven graphical user interface Jobs's history in business has contributed greatly to the myths of the quirky, individualistic Silicon Valley entrepreneur, emphasizing the importance of design while understanding the crucial role aesthetics play in public appeal. His work driving forward the development of products that are both functional and elegant has earned him a devoted following.[12] Jobs is currently on a leave of absence from Apple due to health issues.[13 is considered one of Silicon Valley's leading egomaniacs. Jobs has always aspired to position Apple and its products at the forefront of the information technology industry by foreseeing and setting trends, at least in terms of innovation and style. Digital Rights Management (DRM)-free. End of march Other musinc playing devices (Zune) can play music bought from the iTunes Store (codecs on song required it to be played by a Mac product) DRM (restrcit copying and other illeagal activities)

4 Administrivia http://students.cec.wustl.edu/~ejm3/ TAs! CEC accounts
Lab assignments Readings

5 Data Types Everything in Java has a type Primitive Types
type: “kind of thing” Primitive Types int: Integer number: 5, 10, 15 double: Decimal number: 5.15, 10.25 boolean: true or false String: a string of characters: “Hello World”

6 Expressions Expression: anything that has a value Order of operations
infix expression syntax operators between operands Order of operations Evaluate left to right under the rules Negation (-) Multiplication(*), Division(/), & Modulus(%) Addition(+), Subtraction(-)

7 Expression Trees Evaluated left to right and bottom to top * + % 8 5
18 5

8 String Concatenation Boolean Expressions
+ operator will combine strings together Other primitive values will be converted to strings when concatenation occurs Boolean Expressions Expressions that evaluate to true or false && and operator || or operator ! not operator == equals operator

9 Variables A symbol which can hold a value of a particular type
int age; String myName; double cars; Assign a value of a variable int age = 24; String myName = “Zeke”; double cars = 0.5; Think of a variable as a container with the "right shape" to hold a value of the declared type Assign the value of an expression to a variable double money = (3 * 1.50);

10 Assigning New Values Variables can be reassigned a new value
int age = 24; age = 25; int age = 24; age = age + 1; final keyword forces variable to retain initial value final variables, called constants, have all uppercase names final int AGE = 24; AGE = 25; //Error

11 Composition Combining small blocks of code
How could we compose these three statements into a single statement? int age; age = 24; System.out.print(age);

12 Naming Abstraction Circle Area Example
Giving names to values: using variables What are some advantages? Choose meaningful names for variables! Circle Area Example It saves us from retyping the value all the time and makes programs easier to read.

13 Assignment No Class Monday Readings Wednesday
AD Chapter 2, Chapter 7: KG Notes


Download ppt "Introduction to Computer Programming"

Similar presentations


Ads by Google