CS 145 Lecture 1
September 9, 2011 by Chris Johnson. Filed under cs145, fall 2011, lectures.
Topics Covered
- Hi
- Computer science is the study of process
- Variables
- Assignment operator
- Arithmetic operators
Code
MathFun.java
package lecture;
public class MathFun {
public static void main(String[] args) {
System.out.println(5 + 5);
System.out.println(5 - 100);
System.out.println(5 * 100);
System.out.println(5 / 100);
double taxRate = 0.055;
double costOfPaulsBikeTire = 26.0;
System.out.println(26 + 26 * 0.055);
System.out.println(26 * 1.055);
System.out.println(costOfPaulsBikeTire * (1 + taxRate));
int nEggs = 237;
int nCartons = nEggs / 12;
System.out.println(nEggs);
System.out.println(nCartons);
int nClips = 22025;
int nHours = 24;
double hoursPerMinute = 1.0 / 60.0;
double minutesPerSecond = 1.0 / 60.0;
double clipsPerSixSeconds = nClips / nHours * hoursPerMinute * minutesPerSecond * 6;
}
}
TODO
- Make sure you have the right textbook.
- Read sections 2.1 through 2.2.
Haiku
In the beginning
There was main and it was good
But then I wrote more
show