CMSC 10200: Lab 1

Wednesday, June 22, 2005

<-- back


Things You Need To Do Once

  1. Add the following two lines of code to your .bashrc file:

      JAVABIN="/opt/java2/SunJava2-1.4.2_03/bin"
      export PATH="$JAVABIN:$HOME/local/bin:$HOME/bin:$PATH:."
    
    This will ensure that you're using the correct version of Java for this course.

  2. Add the following text to your .emacs file:

    (set-background-color "white")
    

  3. Make five directories inside your home directory: lab1, lab2, lab3, lab4 and lab5.


This week's exercise: practice writing some simple functions (methods) in Java

In this lab you will write functions very much like the Java fragments you've seen in class.

A necessary technicality of this exercise is that you must include the word static before your function headers. Whereas the Java fragments presented in class looked like

   boolean isZero(int n) {
     return (n==0);
   }
today you will write them as
   static boolean isZero(int n) {
     return (n==0);
   }

We will create a framework for today's exercise as a group. Within that framework, develop the following functions:


If you have time, proceed to the following functions: OR, alternatively, write the functions


You will test each function as you write it, per the instructions given in lab.

When you're finished, submit the whole lab1 folder by typing

  hwsubmit cs102 lab1
at the command prompt.