Students, please be sure to log in. This site does not use cookies and does not track/store work submitted when not signed in.
Unit 5 Problems
Java Reference Sheet
Fraction
In this problem, you are looking at the non-default constructor of a class.
The Fraction class is a class that consists of a numerator and a denominator. The default constructor initializes the instance variables to 1. A non-default constructor has been provided that allows someone to give the values for the numerator and denominator during construction. However, it does not work.
Fix the non-default constructor so that it initializes the instance variables to the parameters. Hint: Assignment Dyslexia