Computer Science 3675
Section 001
Fall 2015
Programming Assignment 8

Assigned: Wednesday, November 11
Due: Wednesday, December 2, 11:59pm

This assignment has you redo the derivative computing program in Java.

Your first derivative program uses a type with several constructors to represent expressions. Java is an object-oriented programming language, and object-oriented programming has a different way of managing types with several flavors. You create an abstract class Expression that stands for an arbitrary kind of expression, and a subclass of Expression for each kind of expression.

This has the advantage that new kinds of expressions can be added just by adding new subclasses. It is not necessary to modify any existing code; you just add new code. Removing a kind of expression is just a matter of removing a subclass. If you imagine providing expressions and derivative computations in a library (which most programmers are not allowed to modify) you can see how useful this approach is. Programmers can add their own kinds of expressions without the need to modify the library.

A starting point is provided for you. Extend this to handle the subtraction, multiplication and constant powers, as you did for assignment 3. A tester is also available. Try compiling and running the starting point files before trying to modify them.

Turning in your solution

Hand in your program using the submit utility, as assignment 8. Turn in both your tester and your file containing the expression classes. Please continue to call them Derivatives.java and TestDeriv.java to make testing easy for me. So use command

  ~abrahamsonk/3675/bin/submit 8 Derivatives.java TestDeriv.java