CS 101 (Fall 2002)
Lab 0: Getting Started

Lab Assigned Design Due
(In class)
10 AM
Implement
(In Lab)
Demo
(In Lab)
Lab Due
(In class)
Friday
10 AM
2 Sep None 3-4 Sep 3-4 Sep 6 Sep

Goals:

By the end of this lab, you should...

Part I: Electronic Orientation

The CS101 web pages will be an important reference in CS101, so it's good to know what's there. They contain everything from lecture highlights to frequently-asked-questions on assignments. The following Web Page Treasure Hunt is designed to make sure you know your way around the CS101 web pages, and call your attention to certain important items along the way.

First, read Navigating the CS101 Web Pages. Then, use the web to answer the following CS101 trivia questions. Write down the answers (handwritten on notebook paper is fine).

  1. When and where are the CS101 organized help sessions? (Hint: Look at the help schedule.)
  2. When and where are the CS101 instructor's office hours? (Hint: Look at the CS101 home page.)
  3. What overall percentage is required to earn an A+ in CS101?
  4. How much time should you expect to spend on CS101? (Hint: Look at the Frequently Asked Questions page.)
  5. What are the email addresses for the head teaching assistants for CS101?
  6. Name one reason why is class attendance so important in CS101. (Hint: Find the Attendance Policy on the home page.)
  7. According to the CS101 Collaboration Policy, would you be cheating if you helped someone find an error in their program? (Hint: Read the examples on the Collaboration Policy page.)
  8. What is the only acceptable way to turn in a lab late? (Hint: Read the late policy).

  9. What is the definition of abstraction?
  10. What is the due date for Lab 4?
  11. On the lecture highlights page, what is the second subtopic under the third main heading in the course outline?

Part II: Getting Started with Java

  1. Log onto a PC in Sever 201 or 202. (If you own a computer and want to set it up for CS101, read how to set up your computer for CS101. In CEC, you'll be using your H: drive, but at home most likely it will be your C: drive.)
  2. On your H: drive, create a folder called cs101, in which to keep your lab assignments.
  3. Click on the "Download Project" link in the online version of this assignment. Ask a TA if you need help. If WinZip doesn't come up automatically the link, you can save the project.zip file in your cs101 folder, and then launch WinZip using the "Start" menu using the "Utilities" submenu.) After the project.zip file is opened within WinZip, click on the extract button in WinZip, select your CS101 folder, and extract the files, making sure that the "use folder names" box is checked.
  4. [[[download project folder]]]

  5. Click on the Start button and look under "Programming" to start up Emacs for Java. Emacs is a text editor that lets you create text files, including files that contain the text of Java programs. With emacs, we have installed the Emacs JDE, which stands for Java Development Environment, which provides facilities for compiling and running your Java programs. (If emacs doesn't open, see the frequently asked questions page or ask a TA.

  6. Pull down the Files menu and select "Open File..." At the bottom of the emacs window, you will be asked to provide the name of the file you want emacs to find. Type h:/cs101/Lab0/Startup.java and then press the "enter" key to open that provided file. At the top of the file, you will see a comment block that identifies the file and explains its contents. Fill in your name, lab section, email address and today's date in the appropriate places. Every file you create should have a header comment similar to this one.
  7. Find the line that says "public void run()".   This is where the Startup object begins running. Type your name in the appropriate place in the message (replacing the XXX).

    Now save the file by selecting "Save Buffer" from the Files menu. Ask a TA if you need help editing or saving files.

  8. Now open the provided file h:/cs101/Lab0/Lab0.java. You'll see a procedure called main, which serves as the starting point for the program. You don't need to modify this file.

  9. Before you can execute a program, it must first be compiled (translated) into byte code that can be executed by the Java interpreter. A program that performs this translation is called a compiler. Compile your program by selecting "compile" from the JDE menu. (If you have edited files but not yet saved the changes, emacs will ask if you want to save them before compiling.) During compilation, an output buffer will appear in which the Java compiler will print messages. Whenever you have compilation errors, they will appear in this output buffer. If there aren't errors, the compiler will create some class files that are the result of the compilation. The class files are not human-readable, but instead they are read by the Java interpreter in order to run your program.
  10. When compilation is successfully completed, run the program you just edited by choosing "run app" from the JDE menu. An output buffer will display the output from your program as it runs. Get help from a TA if the program doesn't execute.
  11. Your program should have created a file called transcript.txt containing the output printed by the Terminal. If you open the file cs101/Lab0/transcript.txt, you should see the output from your program in the file (similar to what you saw in the output buffer). Print this file using the print command in the Tools menu of the editor. Be sure to select "Print Buffer" (not "Print Region", which is used for selecting a portion of the text to print). Pick up your printed output from the printer. Ask if you need help.

    Some people have had trouble printing from Emacs. See this guide on how to change your printer if it's not working.

You now know the steps necessary to edit, compile, and run Java programs. Please ask if you have questions about any of this. A word to the wise: Remember to save your files often, and get into the habit of saving your files onto a floppy disk after each lab session, just in case there is a problem with the file server. Floppies may be purchased at the CEC help center.


Part III: Home Page (Optional)

If you don't already have a home page on CEC, read How To Create a CEC Home Page and follows the instructions. (Please do this even if you already have a home page in Arts and Sciences or elsewhere.)


Part IV: Complete Your CS101 Registration

  1. Read the CS101 Policy on Collaboration. In registering for this course, you agree to abide by that policy and the academic integrity policy of the university. If you do not understand the policy, please ask. If you do not agree with the policy and cannot live according to it, then you should not take this course.
  2. If you haven't yet officially registered for CS101, be sure to do so as soon as possible.

Part V: Physical Orientation

  1. Before embarking on the dangerous journey on your own, try our fun, electronic guide to Ron Cytron's office from CEC. This may be your first time running a Java applet. Be patient, as it may take some time for the program to start up.
  2. Now experience the trip for yourself. Typically, one of your lab TAs will serve as your sherpa for this adventure.
  3. On the back of the piece of paper you used in Part I, write a clear, concise procedure in English that describes, step by step, the process of walking from Sever 201 (the PC lab) to Bryan 525 (without walking outside). Hint: On exiting Sever 201, turn right. The hallway will dead-end into the 4th floor of Lopata. This map of the School of Engineering and Applied Science may help you plan your route. Walk the route and notice things on the door of the professor's office.

What To Turn In:

For every CS101 lab you turn in, you should fill in a cover sheet and staple it on the front of your lab. You can either print out the cover sheet or pick one up from the stack on top of the CS101 mailbox. (If you print the cover sheet, use "print preview" to check that it fits on one page. If it spills onto a second page, decrease the font size preference in your browser so that it prints as a single page.) Attach the following items:

Part I: Your handwritten answers to the questions (or typed if you prefer).
Part II: Your printed transcript file.
Part III: (Optional) A printed copy of your web page, including your name and some information about you. If your web page takes more than one sheet of paper, just print the first page with your name and on it.
Part IV: Nothing needs to be turned in, but be sure you are registered for the course.
Part V: What cartoon appears on the door of your instructor's office? (Or, mention any identifying detail of his office to convince us you've been there.)

Everything should be stapled together and submitted in class on the due date.



Last modified 11:57:36 CDT 03 September 2002 by Ron K. Cytron