CIT 590 Assignment 9: Fraction Calculator
Fall 2015, David Matuszek

Purpose of this assignment

General idea of the assignment

You have written thest two classes in assignment 7:

Your assignment this time is to write a GUI (Graphical User Interface), using Swing, to create and display a working calculator for fractions.


Name your project FractionCalculator, your package fractionCalculator, and define your class as class FractionCalculator extends JFrame.

In assignment 7 I did not specify the name of a package, so you probably used a name like fraction, or if you put the tests in a separate package, it might be something like fractionTest or testFractions. Whatever those packages are named, copy them from the earlier assignment and paste them into this assignment. If they were in the default package, create a package or packages to put them in; don't put them in the fractionCalculator package. Do not simply link to those classes; they must be included in your new FractionCalculator project.

Write a GUI that looks like a "real" calculator, the kind you can buy in any drugstore. Except, your calculator will deal only with fractions. It should use a JTextField to display the fractions, and a number of JButtons to do the arithmetic. To prevent the user from typing directly into the display, send the text field the message setEnabled(false).

"Real" calculators do all sorts of weird things. For example, entering 2 + = will probably result in 4. To avoid dealing with all kinds of special cases, your fraction calculator should follow some different rules.

If you have a question about how the calculator should work, and you don't think it is answered by the above rules, post on Piazza.

Good comments and good style are required, as always. Also, remember you can use SwingExamples.jar for examples of how to do various GUI things.

Due date

Turn in your one zip file to Canvas by 6am Wednesday, November 4.

Notes on submitting your work: