CSCI.4430/6969 Programming Languages Fall 2003
Programming Assignment #2

This assignment is to be done either individually or in groups of two or three. 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 TA or the instructor. You are encouraged to use the WebCT Discussions page to post problems so that other students can also 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 textbook 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 that 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.


Due Date:
Received Time Grade Modification
before Monday, November 3, 11:59PM +10%
Tuesday, November 4, from 12:00AM to 11:59PM no modification (on time)
Wednesday, November 5, from 12:00AM to 11:59PM -10%
from Thursday, November 6, 12:00AM to 
Friday, November 7, 11:59PM
after Saturday, November 8, 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.

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 two), 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 Only submit one assignment per pair via WebCT.