CS 101 (Spring 2000)
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
18 Jan None 18-19 Jan 18-19 Jan 21 Jan

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 first 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 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 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.
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