Outcomes Addressed


Create a Fraction class given in the UML diagram below. You should also design a test program that ensures that your Fraction class is implemented correctly.

Fraction class

You should implement the class shown in the following UML class diagram:

  You need to determine the
approriate fields for your class.
+ Fraction()
+ Fraction(numerator: int)
+ Fraction(numerator: int, denominator: int)
+ Fraction(value: String)
+ add(frac: Fraction): Fraction
+ subtract(frac: Fraction): Fraction
+ divide(frac: Fraction): Fraction
+ multiply(frac: Fraction): Fraction
+ equals(frac: Fraction): boolean
+ compareTo(frac: Fraction): int
+ toString(): String
+ displayAsDecimal(decimalDisplay: boolean): void

Be sure to note the following:

Test Program

You should also write a test program that ensures that your implementation of the Fraction class is correct.

Lab report (due 11:00pm, the day prior to week 7 lab)

Each student should indicate how much time you spend on this assignment in the FAST system. You are encouraged to log your activity as you work on the project. At a minimum, you should log all of the time spent on this assignment before the due date given above. All time spent on this assignment should be entered into the week 6 column (even if you worked on it in week 7).

Dr. Taylor's students should use this XML template as a starting point for their reports.

Each student should submit a lab report. Your report should include:

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost.

If you have any questions, consult your instructor.


This laboratory assignment was developed by Dr. Chris Taylor.