CS110 Exercise 3 (5 points) NAME:___________________
Goal for today: Download more book examples, and use DrJava
for editing.
Fill in check marks in short ___'s or requested information in
longer ones.Turn in one copy and retain another for your own use.
1. Browse to our class web page at www.cs.umb.edu/~eoneil/CS110 ___
2. Download the Chapter 1-12 book examples linked to the
class web page under "Textbook". Use Windows Explorer or Finder to
drag and drop the examples directory to be under your cs110
directory. ___
3. Check that you can find the chap05 directory using Command Prompt
or Terminal.
PC: cd c:\cs110 to get to your cs110
directory from anywhere
dir
to see things there
cd examples
cd chap05 change to the
chap05 directory
dir
should see Age.java, etc
type Age.java to
display it ___
Mac: cd ~/cs110 to get to your cs110 directory
from anywhere
ls
to see things there
cd examples
cd chap05 change to the
chap05 directory
ls
should see Age.java, etc
more Age.java
to display it.___
4. Compile and run the book examples Age.java. Commands:
"javac Age.java" then "java Age", etc.
Show what happened for Age: what you typed, what the computer typed,
line by line:
After "java Age"
_____________________________ (prompt and user input)
_____________________________ (computer output)
_____________________________ (computer output)
5. Run DrJava and use the Open Folder command. Navigate to the
directory chap05 (first find cs110, then examples, then chap05) that
contains the book examples for Chap. 5 and click Select. You should
see Age.java, ..., WinPercentage.java listed on the left hand
side.
a. Select Age.java and see it displayed in the editor window.
b. Click Compile
c. Click Run (on the far right of the top menu bar). If Run is cut
off because of a small screen, you can run use Tools>Run Document
d. Change the program so it says "That's nice" or something else for
ages under 21. Save it. Compile and run it. ___
6. Look for the changed program using Command Prompt or Terminal.
Just follow the instructions again for step 3, then use
PC: dir Age.* (Mac: ls Age.*) (using
wildcard *, asking for all files with names starting with "Age.")
Files seen: _________________ ______________________
The .java file is the source file. The .class file is the result of
compilation, and is what is used with the java command to execute
the program.
7. Using a command, display Age.java to see the edit you made under
DrJava
Command you used to display Age.java:_______________________
8. Execute the changed Age.java using a command.
Command you used to execute Age: __________________________