CS 110: Lab Orientation

advertisement
CS 110: Lab Orientation
Student Learning Objectives
 Receive your CS 110 lab account and change your password to something you
can remember.
 Set up a consistent Windows’ folder structure to save your assignment solutions.
 Know how to use jGRASP to type in, compile, debug, and execute a simple Java
program.
 Map CS 110 Class Folder to your account.
Login to the computer science network
Your instructor has your CS 110 user name and initial password.
1. Obtain a user name and password from your instructor.
2. Sit at any of the available computers in your designated Lab location.
3. You may need to wiggle the mouse or hit one of the keys to “wake up” the
computer.
4. Use Ctrl-Alt-Delete to bring up the login box.
a. Note: make sure the Workstation Only box is checked
b. Log on to the computer science network with your user name and
password.
c. The system will force you to change your password to something you can
remember.
i. If you receive a message saying you do not have permission to
change your password, you will need to restart the computer and
log in again.
ii. To restart the computer, use the Windows Start Menu >> Turn off
computer >> Restart (or use Ctrl-Alt-Delete >> Shutdown >>
Restart
Window Folders
To help with grading, you will need to save your lab and programming assignments in a
consistent folder and naming scheme. Otherwise, your graders will have a fit trying to
guess where you saved your solutions.
All of your solutions need to be stored on your U:\drive (CS network user drive). There
will be six lab assignments, seven program assignments, and one programming exam
this quarter.




Lab assignments need to be saved in folders: Lab1…Lab6
Programming assignments need to be saved in folders: Program1.. Program7
Programming exam needs to be saved in the folder: Exam
HINT: Avoid a blank space before the lab or program number.
Use Windows’ My Computer to create the above folders.
Introduction to jGRASP
Today’s assignment will not be graded, it is only to assist you in getting oriented to the
use of jGRASP. To write your first “Hello World!” program in Java follow these steps:
1. Using Windows’ My Computer, create a folder named Lab0 on your U drive
account.
2. Begin the jGRASP program.
3. Navigate within the left window of jGRASP until you are within the Lab0 folder.
4. From the menu at the top of jGRASP, select: File > New > Java
5. Type the following code in the text editor (upper right window of Jgrasp):
public class HelloWorld
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
Hint: the curly braces, parentheses, square brackets, and semicolon are
extremely important; if you forget to type them, the program will not
compile, and you will get an error message.
6. Now save this file within the Lab0 folder: select File > Save As
a. Make sure that Lab0 is listed as the folder into which it will be saved.
b. Name the file “HelloWorld.java”
i. Note the absence of spaces in the name
7. Compile your code by clicking on the green cross above the text editor. This
converts your code to a form that the computer can understand. If it successfully
compiles, you will see the following message in the lower window of jGRASP:
--------jGRASP: operation complete.
8. Run (execute) your program by clicking on the “running” red person above the
text editor.
9. Verify that the message “Hello World!” appears in the window at the bottom of
jGRASP.
10. You have just successfully compiled and run your first Java program.
11. Using Windows Explorer, examine the contents of the Lab0 folder. There should
now be two files in this folder: the HelloWorld.java file which you wrote and
saved, and the HelloWorld.class file which was created when you compiled the
program.
12. Try the following to gain a better understanding of how to debug (find problems
in) a program.
a. Delete the semicolon and attempt to compile the program. What kind of
error message do you get?
b. Delete one of the curly braces and attempt to compile the program.
13. For additional information on the use of jGRASP, please refer to the jGRASP
web site (www.jgrasp.org); pay special attention to the fact that there are tutorials
available on that site.
The following is a screen shot of jGRASP after it has successfully compiled and executed
a HelloWorld program:
Map CS 110 Class Folder to Your CS 110 Account
1. Open Windows Explorer, or My Computer.
2. Go to: Tools >> Map Network Drive
3. Inside the Map Network Drive dialog box, click the Browse… button
4. Inside the Browse for Folder dialog box, click on the “+” to the left of Cs2k3 to
view all the choices within this domain. If you do not see Cs2k3, click on the “+”
to the left of Microsoft Windows Network to open that folder. Cs2k3 is inside the
Microsoft Windows Network folder.
5. Click on the “+” to the left of Neve to view all the choices within the Neve server.
6. Click on cs110
7. Click OK to close out of the Browse for Folder dialog box.
8. You should see the following in the text box labeled Folder:
\\Neve\cs110
9. Make sure the Reconnect at login box is checked.
10. Click Finish in the Map Network Drive dialog box. This will open the folder
containing CS110 class resources which are located within the Class Folder.
Download