CS141: Topics for Sept 4 & 6, 2013
Homework and Reading
The reading and homework for this week can be found here: Lab 2: Fundamental Data Types
Chapter 2 is full of a lot of vocabulary. It is important that you understand what these words mean otherwise you will be
lost as we go forward. For practice, check out the WileyPlus Chapter 2 Flash Cards!
The words in green will be dealt with in much more detail later, so don't worry if they don't completely make sense.
variable
type
constant
magic number
literal
statement
expression
Mod function
|
declare
initialize
assignment statement
operator
operator precedence
cast
stepwise refinement
|
primitive type vs object
class & object
instance vs static method
dot notation
parameter & argument
method
|
Topics: Variable types, math, I/O
- Variables: What are they, how do you create, name, and initialize them?
- Types: What is a type? Why do we have them? What are examples? Can we convert from one to another?
- Java Statements: What is a statement, expression, value?
- What is a "literal"?
- Assignment statement: What is its syntax?
- Doing Arithmetic
- Operators - binary (+, -, /, *, %) , unary (-, ++, --)
- Operator Precedence and when you must use parentheses
- The Math class for functions such as sqrt, pow, etc. -
Learn to use the javadoc api !
- Conversion between numeric types.
- Magic numbers: What are they? Why are they a problem?
- Constants: What are they? Why do we have them?
- Comments: What are they? Why do we have them? What is their syntax?
- Common Pitfalls:
- Forgetting to declare and/or initialize a variable.
- Declaring a variable multiple times.
- Using integer division when you don't mean to.
- Problem Solving techniques
- Don't jump into coding too quickly. Understand problem, try example by hand, write pseudocode.
- Stepwise refinement - break problem into a sequence of steps that lead to the full solution. Implement
one step at a time, compiling (compile time errors) and testing your code (run time erros)
- Strings: What is a string? What are the String operators? Look at String API.
- Primitive types (int, float, etc) vs Object types (String, Scanner, etc):
- Primitive operators and syntax
- Object/Class operators and syntax: Methods, dot notation, parameter/argument. Static vs instance.
In Class Practice Activities