CS 145 Lecture 1 – Introduction, data, and arithmetic operators
January 25, 2012 by Chris Johnson. Filed under cs145, lectures, spring 2012.
Agenda
- introduction
- our class:
- prior programming experience
- majors
- communication
- math
- two fronts: data and instructions
- arithmetic operators
- variables
- data: ints and doubles
- instructions: System.out.println, + – * / % =
Code
Mathiness.java
package preexam1;
public class Mathiness {
public static void main(String[] args) {
System.out.println(26.16 * 0.15);
System.out.println(1000000.0 / 540000.0);
System.out.println();
System.out.println(57 % 12);
double radius;
radius = 16;
System.out.println(radius);
// System.out.println(Math.PI * 4 * 4);
// Look, Ma! It's symbolic!
System.out.println(Math.PI * radius * radius);
double clipsPerHour;
clipsPerHour = 22050.0 / 24.0;
double clipsPerMinute = clipsPerHour / 60.0;
System.out.println(clipsPerMinute);
double a = 7, b = a;
System.out.println(a);
}
}
TODO
- Read sections 2.1 and 2.2 in your book.
Haiku