
CMSI 182
IN T R O D U C T I O N T O CO M P U T E R SC I E N C E
Fall 2007
Assignment 0920
The core idea behind the data manipulation topic is the way modern computers, regardless of size, power,
or function, really all follow the same structure and “life cycle.” In this assignment, we try to perform the
same kind of breakdown and analysis on other types of “machines.”
Not for Submission
Read Chapter 2 in the Brookshear book.
For Submission
Submit all work on hardcopy at the beginning of our September 20 class.
1. For the following types of “machines,” identify and briefly explain the following:
•Their primary parts
•Their fundamental categories of operations
•What constitutes a “program” that tells them what to do
a. A “cooking machine” — A machine that prepares food for you
b. A “driving machine” — A machine that can take you from point A to point B
c. A “reading machine” — A machine that reads books aloud
2. And now — for a “machine within a machine.” JavaScript is a “machine” that dwells inside modern Web
browsers. Like other types of machines, as well as computers themselves, JavaScript has its own internal
parts, fundamental operations, and some notion of a “program” that tells it what to do.
The JavaScript scratch page on the course Web site provides some relatively easy access to this hidden
JavaScript machine. Type the JavaScript program below into the JavaScript scratch page’s large text area
(replacing the default text that starts out there) and run it by clicking on the page’s Run button. Remem-
ber that absolute accuracy is required — this code must be entered exactly as shown (at least until you’ve
gained a little more experience and knowledge on the subject):
var a = "Hello";
var b = "World";
alert(a + b);
var i = 1;
var j = 1;
alert(i + j);
var c = "1";
var d = "1";
alert(c + d);
var x = 1.5;
var y = 3.25;
alert(x + y);
What happens when you run this program? For each alert command (there are four of them), explain
what you think JavaScript is doing with the expression that is being “alerted.”