CSCI.4430/6969 Programming Languages Spring 2005
Programming Assignment #2

This assignment is to be done either individually or in groups of two or three students. Do not show your code to any other group and do not look at any other group's code. Do not put your code in a public directory or otherwise make it public. However, you may get all the help you need from the TAs or the instructor. You are encouraged to use the WebCT Discussions page to post problems so that other students can also answer/see the answers.

MIJava:  Multiple inheritance extension to Java.

The goal of this assignment is to implement a limited multiple inheritance extension to a subset of Java (see VRH sections 7.4.4 and 7.4.5 and also see FWH exercises 5.31 and 5.32) using OpenJava.

Following is an example skeleton of a program TA.oj in MIJava:

    public class TA instantiates MIJava multiextends Student, Staff {

This TA class extends both the Student and Staff classes.  The code for a sub-class should be able to access information in any of its super-classes.  For example, the Student class may have a getGPA() method which does not apply to Staff objects, and the Staff class may have a getSalary() method which does not apply to Student objects.  However, getGPA() and getSalary() are both valid methods for an instance of the TA class.

Part 1. Simulate multiple inheritance using single inheritance.

In this part of the assignment, you are to write Java code that simulates the MIJava code for a given example (e.g., TA code above).

Since Java does not directly support multiple class inheritance, you are to come up with a strategy to simulate multiple inheritance using single class inheritance.  You may for example use Java's support for multiple interface inheritance.

You need to decide what to do with duplicate method and field names.  Specify your language extension restrictions clearly:  what is allowed and what is not, and what is your conflict resolution methodology.

Part 2. Automatically generate Java code for MIJava.

In this part of the assignment, you are to write OpenJava code that automates the translation of MIJava programs into Java programs.  Your OpenJava meta-class should take MIJava code such as TA.oj and produce the corresponding Java code implementing your multiple inheritance semantics.  The generated code should generally resemble the code you produced in Part 1.  Specify any restrictions and assumptions you make in the process.


Example files can downloaded here. They demonstrate what your strategy for multiple inheritance must handle. These examples will be used to grade your assignment, so if your strategy requires changes to these files due to new syntax, please modify the files as required and upload them along with your project.

There are eight different example folders, each containing a set of classes. What they test is as follows (for more detail read comments in the files). A rundown of what the different examples are is as follows:


Due Date:
Received Time Grade Modification
before Monday, April 4th, 11:59PM +10%
Tuesday, April 5th, from 12:00AM to 11:59PM no modification (on time)
Wednesday, April 6th, from 12:00AM to 11:59PM -10%
from Thursday, April 7th, 12:00AM to 
Friday, April 8th, 11:55PM
after Saturday, April 8th, 12:00AM not accepted

Grading: The programs will be tested on the CS network versions of Java/OpenJava. The assignment will be graded mostly on correctness, but code clarity / readability will also be a factor (comment, comment, comment!).  In particular, make sure you state up front in the README file, the restrictions and assumptions you are making on your input MIJava programs.  See the professor or TAs, if you have ideas for other extensions for this assignment and would like extra credit for implementing them.

Since there have been many questions about the grading, here are more specific criteria about what is expected and how your assignment will be graded.

Part 1: Part 2:

Submission Requirements: Please submit a ZIP file with your code, including a README file with testing instructions and your working examples.  In the README file, place the names of each group member (up to three), and the version(s) of Java that you have tested it under.  Your code will be tested in the CS machines, so make sure it works there.  Your README file should also have a list of specific features / bugs in your solution. Your ZIP file should be named with your WebCT user name(s) as the filename, either or, or Only submit one assignment per group via WebCT.