April 11th, 2014, 11:36 AM
Fraction Calculator class and program
Hello all, been lurking here for several weeks, first time poster.
I am in an advanced Visual C# class (using .net 4.0). A recent assignment was to create a class to do math operations with fractions, and a windows forms application to demonstrate it. Now, I think I have the math operations done correctly (in that the math should provide a correct answer) but the program is not behaving as I expected. When the program calls on of the math methods in my fraction class, it either hangs completely, forcing me to terminate the program, or outputs an incorrect result. I've attached my code here :FractionCalculator_-_Michael_Kestner-2014-04-11.zip Before anybody asks, the instructor specified the method headers to be used in the Fraction class, based on what I've seen while searching for answers, they're a bit unusual.
I think the problem is partly that there's no way to change a fraction's properties once it's been created. For example, I'm pretty sure the program is hanging when I do something like
then later trying to change it like this :
Fraction thirdFrac = new Fraction();
because it can't actually do what I'm telling it to do. Again, the instructor specified read-only properties, otherwise I think this would be pretty easy to fix. I'm just drawing a blank on how to work around this issue. Any advice would be appreciated.
thirdFrac = firstFrac.Add(secondFrac);
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!