** Assignment #4 will likely be due on the same day, so I advise you to do this assignment by 29 September if possible
Develop a Java class for fractions (i.e., rational numbers). You can use a pair of integers to represent the numerator and denominator of the fraction.
Your class should include the following:
toString()
method to convert the fraction to an
appropriate String
format and return it
clone()
method to create a copy of the fraction
and return it
Design questions: How do you handle the reduction of the fractions to the lowest common denominator? How do you represent zero? How do you represent negative values? Do you use a unique representation for each value (e.g., 1/3, 2/6, and -1/-3 in just one way)? How do you handle division by zero?
Document the class appropriately!
Test the program appropriately! I would prefer you to write a
main
method with appropriate tests embedded so that all I
need to do is to execute the class. If necessary, include any testing
output from your test run.
Submit the source code and any testing output via email to
cs581@hal.cs.olemiss.edu.
UP to CSci 581 Assignments page?