From last time…
•

Libraries, Functions, Active Mode, Interaction!

•

Check the site for a list of inspiration sources!

•

We have a Teaching Assistant:!

! Yifan Wang, yifan@cise.ufl.edu!
! Office Hours: CSE309, 2:00pm–3:00pm
Variables

CAP
What is a variable?
•

An address in memory: 0x0000883A!

•

Variables have a type and a name!

int x;
int y;
float weight;
string introduction;
Memory
int x;
The Primitives
boolean!! ! true or false!
char! ! ! ! ‘a’ ‘b’ ‘c’!
byte! ! ! ! -128 to 127
short! ! ! -32,768 to 32,767!
int ! ! ! -2147483648 to 2147483647!
long! ! ! ! larger numbers!!
float! ! ! 3.14159!
double! ! ! float with more decimal places
Common Primitives
boolean!! ! true or false!
int ! ! ! -2147483648 to 2147483647!
float! ! ! 3.14159
Using Variables
1. Declare the variable!

int xposition;

// type name;

2. Initialize the variable!

xposition = 10;

// name = value;
Using Variables
1 & 2. Declare & Initialize the variable!

int xposition = 10;
// type name = value;
Demo Variables
System Variables
mouseX, mouseY
pmouseX, pmouseY
width, height

// sketch dimensions

frameCount, frameRate
displayWidth, displayHeight
dimensions

// screen

key, keyCode, keyPressed
mousePressed

// is it pressed?

mouseButton

// left/center/right
Demo!
System Variables
random() & casting
random(j)

// from 0 to j

random(j,k)

// from j to k

float r = random(24);
int r = random(24);

// needs to be cast!

int r = int(random(24));

// int() method

int r = (int) random(24); // Java cast
For next time…
•

Monday is Martin Luther King, Jr. Day!

•

Read Shiffman, p. 59–70 (Conditionals I)!

•

Project Proposals due on Wed, January 22

Quiz
•

Closed book, 25 minutes, good luck!

More Related Content

PPTX
do over
PDF
19. Algorithms II
PDF
8. Loops I
PDF
11. Functions II
PPTX
Dmx
DOC
09 tajuk 1 إعداد خطة التدريس
PPTX
Used for & Used to (Gerunds & Infinitives)
DOCX
การคิดราคาต้นทุน
do over
19. Algorithms II
8. Loops I
11. Functions II
Dmx
09 tajuk 1 إعداد خطة التدريس
Used for & Used to (Gerunds & Infinitives)
การคิดราคาต้นทุน

Viewers also liked (9)

ODP
La brújula
DOCX
Adachris
PDF
7. Conditionals II
PPT
rory reyes
PDF
2. Processing
PPTX
Evaluation 4
PDF
15. Final Project - Iteration 1
PPSX
How to reuse old objects by 4th 1st EES N ° 4 (Frías Sergio & Décimo Sebastián)
PPT
Evaluation 2
La brújula
Adachris
7. Conditionals II
rory reyes
2. Processing
Evaluation 4
15. Final Project - Iteration 1
How to reuse old objects by 4th 1st EES N ° 4 (Frías Sergio & Décimo Sebastián)
Evaluation 2
Ad

Similar to 5. Variables (20)

PPSX
Data types, Variables, Expressions & Arithmetic Operators in java
PDF
Control structure repetition Tito Lacbayen
PPTX
Pj01 3-java-variable and data types
PDF
4. Interaction
PPTX
Object oriented programming1 Week 1.pptx
PDF
java-basics-1.pdf jfjf hjghjgkj df jfjf hjghjgkj df jfjf hjghjgkj df jfjf hjg...
PPT
Basic of java 2
PPT
Data type in c
PPSX
Java session3
PPTX
Java fundamentals
DOCX
Object Oriented programming language (PRACTICAL LAB MANUAL)
PDF
01 Variables
PPTX
Arduino Functions
PPTX
Computer programming 2 Lesson 5
PDF
Lec-2- Ehsjdjkck. Jdkdbd djskrogramming.pdf
PPT
demo1 java of demo 1 java with demo 1 java.ppt
PPTX
5. variables & data types
PDF
Embedded_C_1711824726engéiiiring_with_the_best.pdf
PPTX
java Basic Programming Needs
PDF
Scope, binding, papameter passing techniques
Data types, Variables, Expressions & Arithmetic Operators in java
Control structure repetition Tito Lacbayen
Pj01 3-java-variable and data types
4. Interaction
Object oriented programming1 Week 1.pptx
java-basics-1.pdf jfjf hjghjgkj df jfjf hjghjgkj df jfjf hjghjgkj df jfjf hjg...
Basic of java 2
Data type in c
Java session3
Java fundamentals
Object Oriented programming language (PRACTICAL LAB MANUAL)
01 Variables
Arduino Functions
Computer programming 2 Lesson 5
Lec-2- Ehsjdjkck. Jdkdbd djskrogramming.pdf
demo1 java of demo 1 java with demo 1 java.ppt
5. variables & data types
Embedded_C_1711824726engéiiiring_with_the_best.pdf
java Basic Programming Needs
Scope, binding, papameter passing techniques
Ad

More from Joseph Murphy (20)

PDF
33. Input II
PDF
32. Input I
PDF
30. Text II
PDF
29. Text I
PDF
28. Video II
PDF
27. Video I
PDF
26. Images II
PDF
25. Images I
PDF
24. Translation & Rotation II
PDF
23. Final Project Iteration II
PDF
34. Final Project Iteration 3
PDF
22. Translation & Rotation I
PDF
21. Mathematics II
PDF
20. Mathematics I
PDF
A. Design Thinking Lecture
PDF
18. Algorithms
PDF
14. Arrays I
PDF
13. Objects II
PDF
12. Objects I
PDF
10. Function I
33. Input II
32. Input I
30. Text II
29. Text I
28. Video II
27. Video I
26. Images II
25. Images I
24. Translation & Rotation II
23. Final Project Iteration II
34. Final Project Iteration 3
22. Translation & Rotation I
21. Mathematics II
20. Mathematics I
A. Design Thinking Lecture
18. Algorithms
14. Arrays I
13. Objects II
12. Objects I
10. Function I

Recently uploaded (20)

PDF
International_Financial_Reporting_Standa.pdf
PDF
What if we spent less time fighting change, and more time building what’s rig...
PDF
Journal of Dental Science - UDMY (2021).pdf
PDF
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
advance database management system book.pdf
PDF
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
What’s under the hood: Parsing standardized learning content for AI
PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
Hazard Identification & Risk Assessment .pdf
PDF
English Textual Question & Ans (12th Class).pdf
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
semiconductor packaging in vlsi design fab
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
International_Financial_Reporting_Standa.pdf
What if we spent less time fighting change, and more time building what’s rig...
Journal of Dental Science - UDMY (2021).pdf
ChatGPT for Dummies - Pam Baker Ccesa007.pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
advance database management system book.pdf
LIFE & LIVING TRILOGY - PART (3) REALITY & MYSTERY.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
Computer Architecture Input Output Memory.pptx
What’s under the hood: Parsing standardized learning content for AI
Unit 4 Computer Architecture Multicore Processor.pptx
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
Hazard Identification & Risk Assessment .pdf
English Textual Question & Ans (12th Class).pdf
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
semiconductor packaging in vlsi design fab
A powerpoint presentation on the Revised K-10 Science Shaping Paper

5. Variables

  • 1. From last time… • Libraries, Functions, Active Mode, Interaction! • Check the site for a list of inspiration sources! • We have a Teaching Assistant:! ! Yifan Wang, yifan@cise.ufl.edu! ! Office Hours: CSE309, 2:00pm–3:00pm
  • 3. What is a variable? • An address in memory: 0x0000883A! • Variables have a type and a name! int x; int y; float weight; string introduction;
  • 5. The Primitives boolean!! ! true or false! char! ! ! ! ‘a’ ‘b’ ‘c’! byte! ! ! ! -128 to 127 short! ! ! -32,768 to 32,767! int ! ! ! -2147483648 to 2147483647! long! ! ! ! larger numbers!! float! ! ! 3.14159! double! ! ! float with more decimal places
  • 6. Common Primitives boolean!! ! true or false! int ! ! ! -2147483648 to 2147483647! float! ! ! 3.14159
  • 7. Using Variables 1. Declare the variable! int xposition; // type name; 2. Initialize the variable! xposition = 10; // name = value;
  • 8. Using Variables 1 & 2. Declare & Initialize the variable! int xposition = 10; // type name = value;
  • 10. System Variables mouseX, mouseY pmouseX, pmouseY width, height // sketch dimensions frameCount, frameRate displayWidth, displayHeight dimensions // screen key, keyCode, keyPressed mousePressed // is it pressed? mouseButton // left/center/right
  • 12. random() & casting random(j) // from 0 to j random(j,k) // from j to k float r = random(24); int r = random(24); // needs to be cast! int r = int(random(24)); // int() method int r = (int) random(24); // Java cast
  • 13. For next time… • Monday is Martin Luther King, Jr. Day! • Read Shiffman, p. 59–70 (Conditionals I)! • Project Proposals due on Wed, January 22 Quiz • Closed book, 25 minutes, good luck!