CSE 341 -- Programming Languages
Spring 2003
|
Department of Computer Science and Engineering,
University of Washington
Steve Tanimoto (instructor)
|
Assignment
1
Version 1.00 of March 31 |
What is a Programming Language?
Due date and time: Thursday, April 3,
2003 (at the beginning of section).
Turn in this assignment as a hardcopy printout. |
Title: What is a Programming Language?
Purpose:
To confront the question of what a programming language is by
working briefly with one system that is on or near the "fringe."
Instructions:
Visit the
Data Factory web page.
-
Try downloading and running
the Even-Odd sorter factory and then the Fibonacci sequence generator.
If you run into any problems, check the class mailing list, and
if your question hasn't already been answered there, ask it there.
-
Next create your own Data Factory program that does the following:
generates a stream of random numbers in the range 0 to 9, and
then sorts the numbers onto three conveyors depending on their
values MOD 3. Thus all the numbers that are congruent to 0 MOD 3
should go on one conveyor, those congruent to 1 on a second conveyor
and those congruent to 2 on a third conveyor.
-
Save your solution using the File menu's Save As option.
Then create a screen snapshot of your factory layout, with the
sorted data showing. You can do this by first using the
MS-Windows operation Capture the Screen Onto the Clipboard.
Then open up Microsoft Paint and Paste the clipboard contents
into a Paint canvas. You can select the desired part of the picture
using the Selection tool. Then copy to the clipboard, begin a new
image and paste the clipboard contents into that new image.
Save your .BMP file in case you need it again. Then print the
screenshot, put your name on it, and turn that in on Thursday morning
with the rest of this assignment.
-
Answer the following questions and turn these in with the
rest of the assignment.
(1) What facilities does the Data Factory offer for specifying
"arithmetic expressions?"
(2) Is there any kind of storage or variable in the Data Factory?
If so, where?
(3) In what ways is creating a data factory layout like
computer programming?
(4) Is the Data Factory's way of expressing computations
a programming language? Why or why not?
Scoring for this assignment: 9 points for turning in
an acceptable screen shot. 4 points each for
answering the questions. Total: 25 points.
For 5 points of extra credit, create a second
Data Factory program and turn in a screen shot of that, too.
The second factory should convert times from minutes to hours
and minutes. It should do this as follows:
Generate a stream of random numbers in the range 0 to 299 (representing
input times, in minutes); for each input number, there should be
two output numbers, put onto parallel conveyors so that the correspondence
is easy to see.
One output should represent the number of
hours and the other should represent the number of remaining minutes.
As an example, suppose that the input number is 135, then the outputs
should be 2 and 15, since 135 minutes equals 2 hours plus 15 minutes.