This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.

shandilya is correct that you can directly to the math 3/8*5/9, however, depending on how you set it up (i.e. what type of primary your answer variable is set up as), you will end up either with a truncated integer (int) of zero, or a floating point number (i.e. a decimal number) of 0.06944444. (And no need to use BigInteger).

If you want your answer to be a fraction, you would need to create a Fraction class. Define it with two int's as instance variables to represent the numerator & denominator. Then create various methods for adding, subtracting, multiplying, etc. You would also probably want a reduce method, and perhaps a findCommonDenominator method. All the things you need to do true fraction math.

Then override Object's toString method to output the result as a fraction. [ January 15, 2005: Message edited by: Mark Vedder ]

glen li
Greenhorn

Joined: Aug 24, 2004
Posts: 19

posted

0

Thanks guys for making it clear!

glen

I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com