Programming in a Nutshell

Tom Kelliher, CS 102

Feb. 12, 2001

Administrivia

Paper due Friday.

Announcements

Assignment

From Last Time

Discussion on a variety of technology issues.

Outline

  1. Basic features of Javascript.

  2. Javascript lab.

Coming Up

Spreadsheets.

Programming in a Nutshell

  1. A very primitive language, English-like but adapted for the computer.

  2. High-level-language compiled to assembly language which is assembled to machine language (binary code).

  3. A sequence of simple instructions (statements):
    1. Calculate this and store the result here.
      birthYear = currentYear - age - 1;
      

    2. Compare these two values.
      if (age >= 30)
         document.write("We can't trust you!<br><br>");
      else
         document.write("I wish I were young again!<br><br>");
      

  4. Basic constructs:
    1. Straight-line execution.

    2. Conditional execution.

    3. Repetitive execution --- loops.
      for (i = 1; i <= age; i = i + 1)
          document.write(i + "<br>");
      

    4. Communicating with the world --- input/output statements.
      name = prompt("What is your name?", "");
      document.write("Hello " + name + "!<br><br>");
      
      Output sent to the browser, so HTML tags can be used!



Thomas P. Kelliher
Sun Feb 11 10:26:51 EST 2001
Tom Kelliher