CS 214 Lab 8: Aggregate Types

Last week, we examined the facilities in each of our languages for creating an object capable of storing multiple values of the same type, which is usually called an array.

This week, we examine the facilities of each of our languages for creating an object capable of storing multiple values of arbitrary types: which is generically known as an aggregate. Along the way, we will see each language's assert() mechanism that supports automated unit-testing.

We will look at the aggregate construct in each of the languages:

As in past weeks, we will solve the same problem in each of our four languages, to compare their particular constructs. This week's problem is this: create an aggregate type called Name to store a person's name, plus the following Name operations:

As before, we will provide program "skeletons" that provide a framework for calling these functions. Since the sole use of these programs will be to test our Name operations, they have no algorithms.

As usual, we will lead you through the process using Java, after which you will apply similar techiques to solve the problem in the other three languages. As usual, the order in which you do the three exercises does not matter.

Begin by making a new directory for this lab exercise and changing directory to that new directory.

  1. Java Introduction
  2. Ada Exercise
  3. Clojure Exercise
  4. Ruby Exercise

Turn in. Each of the four parts requires you to create files containing source code and execution traces. When you have completed them, use cat to create a single file that contains all of your results:

   cat script.java script.ada script.clojure script.ruby > lab08-results
Then submit your work by copying that single file into your personal folder in /home/cs/214/current/:
   cp lab08-results /home/cs/214/current/yourUserName
replacing yourUserName with your login name. The grader will access and grade your results from there.

Calvin > CS > 214 > Labs > 08

This page maintained by Joel Adams.