You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would simplify() modify the current object or return a new, simplified fraction?
Hm, I would accept that simplifying automatically should be default. What if we just kept a reference internally to the originally entered fraction?
Otherwise I would be in favor of returning a new Fraction object since I'm a sucker for functional programming. :)
Should we just get rid of simplify() in the constructor completely?
I think that's probably the most straightforward way to implement this.
How should we cope with 1 3/4? Should we introduce a whole number part? This would allow us to distinguish between 7/4 and 1 3/4.
Yeah that's a good question. The dumbest solution is to just keep a reference to the originally referenced string, similarly to how I proposed handling the originally entered numerator and denominator but I don't think that's the best solution.
Currently functionality
Proposed functionality
Open questions
Would
simplify()
modify the current object or return a new, simplified fraction?a. Modify current object:
b. Return new Fraction
Should we just get rid of
simplify()
in the constructor completely?How should we cope with 1 3/4? Should we introduce a whole number part? This would allow us to distinguish between 7/4 and 1 3/4.
The text was updated successfully, but these errors were encountered: