CSC 207 Grinnell College Fall, 2014
Algorithms and Object-Oriented Design

Getting Starting with Java and Eclipse

Shifting from Scheme and MediaScript to Java and Eclipse


This laboratory begins a transition from working with the Scheme or C programming language to programming in Java within the Eclipse Integrated Development Environment (IDE).

Background Reading

Before working on this lab, be sure you have read the readings on An Introduction to Objects, Files in Java, and Getting Starting with Eclipse

A Simple Course Class in Scheme

Consider a simple class that would maintain information about a course. Each object in the class might have the following characteristics:

The reading on An Introduction to Objects describes two Scheme implementations of a course class in Scheme. These programs are available as and

  1. Experiment with program

    1. Load the program into Scheme.
    2. Test with the following sequence of commands:
      (define myCourse (course "CSC"  207  4  "Algorithms and Object-Oriented Design"))
      (define yourCourse (course "Math"))
      ;; test of initialization, toString, and extractor methods
      (myCourse 'toString)
      (yourCourse 'getSubject)
      (yourCourse 'getNumber)
      (yourCourse 'getTitle)
      (yourCourse 'getCredits)
      ;; set fields
      (yourCourse 'setNumTitle 131 "Calculus I")
      (yourCourse 'setCredits 4)
      ;; print results of modification
      (yourCourse 'toString)
    3. Explain in a paragraph or two how program works.
  2. Repeat Step 1 with program

  3. Be sure you understand how this code works. In particular, answer the following questions.

The Course Class in Java

Program provides a translation of the Scheme code (particularly to Java.

  1. Experiment with program, calling this program, as you register it with Eclipse:

    1. Follow the steps outlined in the reading, An Introduction to Eclipse to start Eclipse, copy-and-paste into Eclipse, and run the program.
    2. Be sure you understand how this code works by answering the questions of Step 3 for this Java program.
  2. Explore some of the Eclipse environment by introducing several typographical errors in Then try compiling and running the program, and record what happens.

  3. Create a new copy of in Eclipse by importing the full program, following the instructions in the reading, An Introduction to Eclipse After importing the program, compile and run it.

  4. Within main, create a new object for a 1-credit computer science course, CSC 299, "Computing and Health Care" (the name of a special topic course a few semesters back). Also add print/println statements to print out information for this additional course.

  5. Following the style of the Modifier methods in, add new methods setNumber and setTitle. Then add testing code to main for these new methods.

This document is available on the World Wide Web as

created 3 April 2001
revised 22 January 2012
last revised 1 September 2014
Valid HTML 4.01! Valid CSS!
For more information, please contact Henry M. Walker at

Copyright © 2011-2014 Henry M. Walker.
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License .