Students, please be sure to log in. This site does not use cookies and cannot store work submitted when not signed in.

Unit 5 Problems

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

Type your solution        
Skills Practiced:
3.B
4.A
4.B
Copyright © StudyCS 2024 All rights reserved.