Download presentation
Presentation is loading. Please wait.
1
Problem Solving Session
Classes and Objects
2
Fraction class Write a Fraction class that has two members: a numerator and a denominator. Both are of type double. Provide get and set methods for these two variables. You also need to provide a no-argument constructor that sets the numerator to zero and the denominator to one.
3
Fraction class cont’d You should also provide a two argument constructor that takes in a numerator value and a denominator value. Your class should have an additional two methods: multiplyFractions divideFractions
4
Fraction class cont’d Write a class called FractionDemo that uses the Fraction class to allow the user to enter two fractions, multiply them and divide them.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.