CS 214 Project 7: Array processing


This week's project is to write two utility subprograms for array processing in each of our four languages. More precisely, for each of our four languages, write:

For example, a C++ function to display an array of doubles might be written as follows:
   #include <iostream.h>

   void printArray(double anArray[], int itsSize, ostream & out = cout)
   {
      for (int i = 0; i < itsSize; i++) {
         out << anArray[i] << endl;
      }
   }
Similarly, a C++ function to fill an array of doubles might be implemented as follows:
   void readArray(double anArray[], int itsSize, istream & in = cin)
   {
      for (int i = 0; i < itsSize; i++) {
         in >> anArray[i];
      }
   }

Your project is to implement the equivalent subprograms and a main "driver" program to demonstrate them in Ada, Clojure, Java, and Ruby. Your driver should

  1. Prompt the user to specify how many values are to be in the array,
  2. Use the subprogram you wrote to allow the user to specify the array values, and then
  3. Print the resulting array.
Note that in Ada, you will need to create a nested scope in order to create an array of a user specified size (even though you only need a one-dimensional array, you may find it helpful to google "Create a two-dimensional array at runtime").

Turn in. Create project script files showing correct compilation (when appropriate) and execution of each language. Then use cat to create a single file that contains all of your source code, compilation and results:

   cat projScript.java projScript.ada projScript.clojure projScript.ruby > proj07-results
Then submit your project by copying that single file into your personal folder in /home/cs/214/current/:
   cp proj07-results /home/cs/214/current/yourUserName
replacing yourUserName with your login name. The grader will access and grade your project results from there, using the criteria from this grade sheet.


Calvin > CS > 214 > Projects > 07


This page maintained by Joel Adams.