0

can someone help...here's the assignment and what i have thusfar...I'm confused with adding the addtl constructor.

```
//Create a class called Fraction with the following member variables and methods:
//" Variables
//1. numerator and denominator (Integer)
// Methods
//1. Accessor methods for member variables (could be inline functions)
//2. Mutator methods for member variables
//" should not allow denominator to be set to 0
//3. A method named reduce that will reduce fraction to lowest terms
//" ex. 9/15 = 3/5
//4. A method named print that will print the fraction in the form: numerator / denominator Ex. 3/5
//5. A default constructor that initializes numerator to 0 and denominator to 1
//6. Another constructor that takes 2 arguments (to set numerator and denominator) Hint: use mutator methods
#include <iostream>
using namespace std,
class Fraction
{
private:
int numerator;
int denominator;
public
fraction() // default constructor
{
numerator = 0;
denominator =1;
}
int GetNumerator() { return numerator; }
int GetDenominator() { return denominator; }
double GetFraction() { return static_cast<double>(numerator) / denominator; }
};
Fraction cDefault; // calls Fraction() constructor
std::cout << cDefault.GetNumerator() << "/" << cDefault.GetDenominator() << std::endl;
```

*Edited 5 Years Ago by Narue*: Added code tags