There is a way to represent fractions over here. Is there a clear abstraction to represent mixed fractions, so that you can perform addition, subtraction, multiplication operations on it.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could perhaps do this by extending
Fraction: you might want to add a new constructor that takes a whole number in addition to the numerator/denominatornew MixedFraction(2,3,4)for 2 3/4, and overridetoStringto display in the desired format.