CS 145 Lecture 1

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

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *