CSE 142 Homework 0

April 4, 2003

 

Purpose: This assignment will help you become familiar with the Introductory Programming Laboratory (IPL) in Mary Gates Hall, the course web, and some of the tools you'll be using throughout the semester. It will also give you a feel for how our homework assignments are handed out and turned in.

 

Time: This is intended to be a simple assignment and should take you between 1 and 3 hours to do well. Many of you may finish faster but some of you will take longer, particularly if you get side-tracked. If you are comfortable with computers you might try to finish the assignment as efficiently as you can. It’s a good habit to get into.

 

Turn-in, grading and due date: The turn-in consists of an email to your TA and a Java class file you will turn in using the course web site (details explained below). The grading is simple; no credit, full credit or half credit. The due date for both the email and Java class file is 6 pm tUESDAY April 8.

 

Do you have to use the IPL? No, you may be able to work at home. See the 142 homepage for pointers about that. Even so, it is good to have a backup in case something happens to your own computer, so take a little time at least to locate the IPL and find out how to use it – just in case.

 

Finding the IPL: The Introductory Computing Laboratory (IPL) is located on the third floor of Mary Gates Hall. Once inside, find a Windows PC to log onto. You must have a UW NetID to log on to one of these computers, or any of the public access computers on campus. If you do not yet have one, find one of the computers along the wall adjoining the commons area that has a large sign saying "Create New Accounts Here." Students not working in Mary Gates Hall can simply go to the UW NetID web page.

 

When you get there: Try to do and understand everything on this sheet (at least). Be ready to experiment if something isn’t immediately obvious, but when that doesn’t work don't be afraid to ask for help! The operator at the front desk usually can't leave the work area to help you. If there is a 142 consultant on duty (the operator can tell you if there is), you can contact that person for help (the operator can tell you how). No consultant? Ask the person sitting next to you! It's likely a classmate working on the same assignment. This is also a good way to meet new people. Also, don't be afraid to offer help if you notice someone cursing under their breath. There will be times when you will feel the same way and wish that someone would offer to help you. Furthermore, explaining to others is one of the best ways to consolidate and improve your own understanding of the material – grab your chance when you see it.

 

When you leave: The files you create on IPL computers will be deleted automatically when the system is restarted. You can use floppies to save copies of small files, and learn to use FTP (the File Transfer Protocol) to move copies of larger files to your home directory. You won’t need to keep copies of anything you do for this assignment though. By the end of the quarter everything you’re originally doing for this assignment will be thoroughly ingrained because you’ll have done it so often. 

 

Windows basics: You need to understand all of these concepts or operations to use Windows effectively: desktop, mouse, left & right mouse buttons, click, drag, icon, "start" button, open (application), minimize, maximize, close (window or application), pull-down menu, scroll-bar, dialog box, Windows Explorer, folders/files, shut down, menu bar, tool bar, window pane. If something (window pane for example) isn't immediately obvious it will likely become clear as you work through this assignment.


Web Browsing, Email and the Course Web Site

Web browsing: Web browsers like Mozilla and Microsoft Internet Explorer (IE) display files from the World Wide Web. We will use the Web to communicate with the class, to distribute handouts, to distribute homework files, and to turn in homework.

 

Course web site: To open a browser, click the Start button on the taskbar at the bottom of the screen and select IE or Mozilla. Start by visiting the course Web site at http://www.cs.washington.edu/142/. Then click on the various "active links" (underlined and in color) and look at the pages they take you to. Use the "Back" button to return from the current page to the previous one. It’s a good idea to make a printout of the file you're reading now, using File –> Print on your browser’s menu bar. The printout is sent to a printer near the lab operator's station; you can go there to claim it. If you haven’t played with the Web very much, you  might want to goof around a little bit and see what you come up with. The Google search engine (http://www.google.com/) can find almost anything you want. Be forewarned though – the Web isn’t infinite, but at times it can feel like an infinite time sink.

 

Email: To be completely connected in the class, you need to use email. Your  UW NetID includes an e-mail account which we strongly recommend you use for anything related to this course. If you are new to email, you should learn how to use email at the UW. As usual, the other students, lab consultants and your TA can help you if you have a problem – so don’t be shy.

 

Using email for homework turn-in: When you use email to send homework solutions to your TA you must include your full name, your student number, your quiz section and your email address in the text of the message. 

 

Treasure hunt: After familiarizing yourself with using the IPL for email and web browsing you can turn to the second part of this assignment, which is to use the CSE 142 course web to locate the answers to the questions listed below. After you find the answers you should send them by email to your TA. Don’t forget the four things you need to include in a solution email to your TA, as listed above.

  1. On the Version C of the CSE142 final exam for Spring, 2000, what was the answer to question 2?
  2. Which of our quiz sections, if any, meet in Loew Hall?
  3. a) As the day-by-day course schedule stands now, on which date will the topic called "Testing and debugging" be covered in quiz section?
    b) In order to be prepared for the last lecture of the seventh week, which chapter(s) should you have read in advance?
  4. Where does your TA hold office hours?
  5. True or False: If you have a question, you can ONLY go to see your own professor or your own TA.
  6. a) True or False: "When writing programs in the course, it is OK for a group of people to work together to solve the problem."
    b) True or False: "When writing programs in this course, it is OK to use part of someone else's program, as long as it has been modified by you."
    c) Where in the Web did you find the answers to 6a and 6b?
  7. What is the URL of the Official Homework Submission Policy for CSE 142?
  8. Computers are available for your use in the IPL. What does the abbreviation IPL stand for, and where is it located?
  9. Who did Prof. Alon Y. Halevy use to  be?
  10. Where does Prof. Martin Dickey like to get his coffee?

You probably shouldn’t spend more than a half-hour on these questions, or thereabouts. You can still get full credit for the assignment if you leave out a couple of answers. The next part of the assignment is more important to do fully.


Working with Java Code

Goal: The purpose of this part of the assignment is to learn how to operate one of the software development environments you can use for this class, and to learn how to submit homework solutions for grading using the course web site. This is a chance to start reading and tinkering with some code, to be well prepared for the next assignment.

 

Overview: You are going to download a Java source code file, use a development environment called Dr. Java to compile it into a program, run the program, and finally modify it a little bit and repeat the compile-run procedure. Your turn-in is the program you created, in the form of a Java class file.

 

Detailed instructions:

1.      Download the source file:

a.     Go to C:\cse and create a new folder called Code

b.     Click this source file link to download the Java source file

c.      Save the source file in your newly created folder

d.     You should now have the file HelloWorld.java in C:\cse\Code

e.     Make sure that you don’t change the file name! Correct use of capital letters is important when working with Java code. This also applies to file names!

2.      Start Dr. Java

a.     Using the taskbar at the bottom of the Windows desktop, click Start -> Programs -> CSE 14x -> Dr Java

3.      Open the source file in Dr. Java

a.     Using Dr. Java’s menu bar, click File -> Open

b.     Using the dialog box, select the Code directory and click the Open button

c.      Double-click HelloWorld.java to open it

4.      Read the Java code in the file. Do you understand what it does?

5.      Compile HelloWorld.java

a.     Click the Compile All button on Dr. Java’s tool bar

b.     Read Dr. Java’s response in the Compiler Output pane at the bottom of the screen. It should say “Last compilation completed successfully”

c.      Verify that you just created a new file called HelloWorld.class in the directory C:\cse\Code

6.      Run the HelloWorld class

a.     The Interactions pane is to the left of the Compiler Output pane. Click on it to activate it. The first line should say “Welcome to DrJava.”

b.     Type java HelloWorld and hit return to run the class.

c.      What did running the program do?            

7.      Modify the code – just a little!

a.     Replace the line

System.out.println(“Hello World”);

with a new line that prints your TA’s name instead of the word World

b.     Add a new line that introduces yourself. For example, if your name is Hotshot Joe, add the line

System.out.println(“My name is Hotshot Joe”);

c.      The line

// What do you think this does?

is a comment. Replace it with a more descriptive comment of what the code is intended to do

8.      Repeat steps 5 and 6 to create and run your new version of the HelloWorld class. Make sure it does what you want it to do. What were the effects of changing the comment line in step 7.c?

9.      To turn in your solution, go to the turn-in page for homework 0 on the course web site. Fill out the form and use the browse button to find the HelloWorld.class file. Make sure you send in the class file, not the Java source file you downloaded and modified! When you are sure you have filled in the form correctly, click the turn-in button. You must use the Web form to turn in the class file.  You won’t get credit for it otherwise.

 

Now what? You’ve completed homework 0 but playing more with Dr. Java will most likely be time well spent. See what happens if you delete a semi-colon and re-compile? What does sea-blue and yellow highlighting indicate? What happens if you double-click a yellow line in the Compiler Output pane?

 

Dr. Java Help: Dr. Java, like most applications, comes with a help file that explains how it should be used. Scanning the help file will explain what most or all of the buttons, panes and menu items do. Don’t despair if you don’t understand everything – if you do understand everything you probably shouldn’t be taking this course.