The high level objectives of this lab are:
To get used to working on eagle, the canonical machine for this class.
To review the programming constructs that you worked on in comp101 including
Java can, in theory, be programmed on any machine with any operating
system and the program will run on any other system. However, in
practice there are sometimes strange incompatiblities when moving from
one system to another. Eagle is the canonical system for this class.
You may program your assignment anywhere you like, but it must run on
eagle. I will run all of your programs and if they do not run on eagle,
you will lose points from your assignment. To that end, the beginning
of this lab is intended to get you used to working on eagle.
Once you have received your cs 102 account for the semester, you must first set the password. To do that use a telnet program and connect to eagle. You should only telnet this first time. You must used telnet from on campus. Because it is an insecure protocol, it is no longer available from off campus. Once your password is set, log out.
Now use ssh to log in. ssh is the “secure shell”. It is much more secure than telnet and will give some nice features that we will use later in the class.
Ssh is available built in on Macs and Linux/Unix computers. For windows users there is a free program called putty that you can download and install to give you ssh capability. (see http://www.chiark.greenend.org.uk/~sgtatham/putty/ for the putty home page.)
Or you can use the CD for windows that I gave out in class.
now log into eagle.
ssh <usename>@eagle.bridgew.edu (where you must replace <username> with your actual eagle username)
Now copy two configuration files. Type (or paste in) the following commands
cp /export/spare/faculty/jsantore/.tcshrc-cs102 .tcshrc
If you are typing the line, note that there is a space between
-.tcshrc-cs102 and .tcshrc
cp /export/spare/faculty/jsantore/.profile .
Once again, if you are typing this, make sure that you put a space
between the .profile and the final '.' character. The final . character
means that
cicero {~/teaching/Spring2006/cs2/lab1} >java App
Play a pick four game?
(enter Y to play pick four, anything else for pick 3)
y
How many chances do you want to buy?
5
Your bets:
[[10, 6, 16, 9], [14, 4, 2, 12], [3, 16, 16, 16], [3, 6, 16, 10], [18,
20, 7, 15]]
The winning numbers were:
[3, 7, 2, 24]
Your net income from playing the lottery: -5 dollars
cicero {~/teaching/Spring2006/cs2/lab1} >java App
Play a pick four game?
(enter Y to play pick four, anything else for pick 3)
N
How many chances do you want to buy?
8
Your bets:
[[1, 25, 11], [2, 15, 23], [16, 5, 12], [19, 23, 14], [19, 23, 12],
[10, 23, 15], [23, 22, 24], [17, 9, 12]]
The winning numbers were:
[21, 8, 13]
Your net income from playing the lottery: -8 dollars
To write your program you will need to use an editor. In the past many students have written their programs using notepad as their editor and then used ftp to move the file to eagle. This was done because the tools available on eagle at the time were rather limited. I suggest you write your code on eagle itself after connecting through ssh using the CD that I gave you in class.
If you have high speed internet - especially from school:
Users who have fast connections should probably use emacs. It is the most full-featured of the editors. To run emacs, type
emacs <filename.java> &
where <filename.cpp> is the cpp file you want to edit.You
will have an emacs window popup on your screen and you will be able to
use menus normally. This editor also "pretty prints" your text using
colored text for java keywords and constants. It will also indent your
text for you properly giving you a better feel for your program. You
will get a java menu that allows you to compile your program directly
from emacs rather than returning to the command line.
The '&' character means "run this in the background". In plain english than means "give me my prompt back after you run this program"
If you have slower speed connections - mainly off campus
Use xjed, which will also displays keywords in color and indents text. It doesn't have quite as much functionality and isn't as pretty, but it is faster.
xjed <filename.java> &
When you are ready to try compiling what you have written
Pull your emacs or xjed window out of the way and use javac to
compile files. Use java with the name of the class that contains the
main method to run your program.
If you are in your lab1 directory when you read this, move to the
parent folder/directory
cd ..
(where the '..' means <parent directory> note that there is a
space between cd and ..)
now zip up the entire lab1 directory and send it to me.
zip -r lab1.zip lab1
This means zip up the entire lab1 directory (the -r flag says do
everything in the directory not just the directory itself) and put it
in a file called lab1.zip
Now prepare to email your lab to me.
type the following command
pine
Pine is a terminal based email program. From eagle, you will only be
able to send mail to bridgew.edu email addresses. You will submit your
lab by email to me this semester. However you need to configure pine
the first time you use it.
Choose 'c' to compose a mail and send me a mail with the zip file of your lab solution attached.