Lab 1

CS 145 Fall 2007

  1. Using your operating system
    Below are a number of operating systems tasks you should be able to accomplish in order to make your work easier as a programmer. Make sure you can do each of them or try to discover how to perform each one by viewing the various menus, using your common sense and what you know about operating systems, working with others, and working with the help system. You will not be required to write a description of how to perform each capability but make sure you know what to do. Don't fool yourself! When you are finished, let the instructor know so that you can demonstrate something to others.

    1. Manipulating Windows. How do you:
      -move a window
      -re-size a window
      -move from one window to another
      -close a window?

    2. Disks, Files and folders. How do you:
      -display the contents of a folder
      -create a new folder
      -copy a file to a different folder on the same disk
      -move a file to a different folder on the same disk
      -copy a file to a different folder on a different disk
      -move a file to a different folder on a different disk
      -delete a file or folder

      (Be sure you know how to copy files to/from a floppy disk, zip disk or pen drive as you should ALWAYS have at least two backup copies of any files that are at all important.)

    3. Working Programs. How do you:
      -start a program that has an icon on the Desktop
      -start a program that does not have an icon on the Desktop
      -start a second program
      -move from one program to another?

  2. Email
    Each of you should have an email account. Please let the instructor know if this is not the case. Your tasks are to:
    1. Make sure you have included an email address that you plan on checking regularly on the distribution list for the instructor. To do this you must go up to the instructor's computer at the front of the room. Remember, your instructor may occasionally send you email so please check your account regularly. Email is also a good way to communicate with your instructor on matters you would prefer remain private.

    2. Practice sending email to one of your fellow class members. Make sure you have each other's email addresses as you may want to communicate with each other directly.

  3. Blackboard/WebCT
    1. Make sure you can get into your Blackboard/WebCT account and understand how to use it.

    2. Practice using the chat system in Blackboard/WebCT by getting into the Room1. There are no official assignments related to the chat system but you are welcome to use it to work with each other. In addition, if you want, we can hold study sessions using chat. Remember, take advantage of your instructor!

    3. Note that Blackboard/WebCT allows you to review your grades. The instructor will be posting grades to this site. By the end of class you should be able to see your grade for lab attendance.

  4. What you need to know about your Integrated Development Environment (IDE)
    In this course we will probably be using two different programming environments. Today we will explore DrJava, the programming (developing) environment that comes with your text. It is called an "Integrated Development Environment(IDE)" because it includes (integrates) a text editor (where you will write your code), a compiler (to translate the code you write into a form usable by your computer), and other tools that we will explore later.

    1. At this point it is assumed you have read section 2.2 in your text. Step 1 on page 16 in the text has already been done for you. If by lab time, step 2 has not been completed, we will do it together.
      Note:
        If you do not see DrJava on the desktop or in the "Start" menu, it is presently in the C:\Temp folder. You will also find all the classes that come with the book in this folder, in the subfolder "bookClasses".

        You can start DrJava by going to the Temp folder and clicking on the DrJava icon. To make things easier the next time you want to run DrJava, you might want to create a "shortcut" to DrJava and copy this shortcut to the desktop. If your system displays a message saying it cannot find the "tools.jar" file when you start DrJava, click "yes" and navigate to the folder:
        c:\Program Files\Java\jdk1.5.0_01\lib

        You should see tools.jar in this folder. DrJava should now start with no problem.

    2. Start DrJava and make sure you can relate what is described on page 18 with what you see on the screen. In other words, make sure you can find:
      • The files pane
      • The definitions pane
      • interactions pane

      Also, make sure you understand the purpose of each of these panes. In the "definitions" pane write a short description of what each of these is for in your own words. When finished, save your work to your personal storage device and see if you can print it. (If you did not bring in your own storage device, try saving to the temp directory on the 'C' drive.)

    3. The following DrJava capabilities are useful to know. Try to discover how to perform each one by viewing the various DrJava menus, using your common sense, working with others, and working with the DrJava's "help" system. As above, you will not be required to write a description of how to perform each capability but when you feel you can do all the tasks below, call the instructor over and provide a demonstration of your abilities. (Some of these you had to learn for the previous exercise.)

      1. File Handling. How do you:
        -create a new file (edit) window?
        -save the contents of an edit window to a file?
        -open an existing file into an edit window?
        -save the contents of an edit window to a file under a different name or in a different folder?
        -print the contents of an edit window?

      2. Working with text. How do you:
        -move some text to a new location in a file or to a different file?
        -copy text?
        -find a word or phrase in a document?
        -replace a number occurrences of a word or phrase all at once?


      3. Now that you know how to do all these things, use the "help system" to learn two other things about DrJava.

  5. Exercises
    1. Make up some calculations similar to the ones on page 19 in the text and try them in the interactions pane.
    2. If none of your calculations in the previous exercise required the need for parentheses to insure the proper calculation, make up some now and do them. When you are finished, call the instructor over.
    3. Using some of the same calculations, or different ones, use
      System.out.println()

      as shown on page 21 to produce answers.

    4. Make up your own example of a need to use "casting" to get the answer for a calculation similar to the one shown at the top of page 22. When you are finished, call the instructor over.

    5. 2.8, page 35
    6. 2.9, page 36. Note that "time and a half" means that your actual salary is 1.5 times the given salary.

    7. 2.10

  6. Homework
    1. Describe in your own words what you understand an object and a class to be. As part of your explanation, provide some examples.
    2. Exercise 2.2, page 35
    3. Exercise 2.4
    This is due next Monday at the beginning of class.

    Note: Lab work that does not have its own date is due at the beginning of the next lab. This time, however. the homework is due on Monday.