/* * Intro to Programming CSE 1310 * University of Texas at Arlington */ /* * File: main.cpp * Author: jcmtiernan * * Created on June 29, 2017, 3:03 PM */ #include #include #include "Fraction.h" // Use FractionJ6.h and rename #include "Fraction.cpp" // Use FractionJ6.cpp and rename using namespace std; /* * */ int main(int argc, char** argv) { int alpha = 15; double beta = 4.5; Fraction frac1; Fraction frac2(3,5); cout << "alpha is "<< alpha << " and beta is "<< beta << endl; frac1.Setnum(4); cout << endl; cout << "Fraction 1: " ; cout << frac1.PrintFrac() ; cout << endl; cout << "Fraction 2: " ; cout << frac2.PrintFrac() ; cout << endl << endl; frac1.SetFrac(3, alpha); cout << "updated value of Fraction 1: " << frac1.PrintFrac(); cout << endl << endl; int numer; cout << "value of Fraction 2: " << frac2.PrintFrac() << endl; cout << "value of Frac2 num: " << frac2.Getnum() << endl; cout << "value of Frac2 denom: " << frac2.Getdenom() << endl; cout << "Please enter an integer: "; cin >> numer; frac2.SetFrac(numer, frac2.Getdenom()); cout << endl; cout << "New frac2 value: "; cout << frac2.PrintFrac() << endl; cout << "Decimal value of Fraction 2: " << frac2.GetDecimalFracValue() << endl; cout << endl; Fraction frac1A(1,2); Fraction frac1B(1,2); Fraction frac2A(2,3); Fraction frac2B(1,4); cout << "The product of Fraction frac1A * frac1B = " << frac1A.PrintFrac() << " * " << frac1B.PrintFrac() << " = " << frac1A.MultiplyFraction(frac1B).PrintFrac(); cout << endl << "The * product of Fraction frac1A * frac1B = " << frac1A.PrintFrac() << " * " << frac1B.PrintFrac() << " = " << (frac1A * frac1B).PrintFrac(); Fraction frac3A(2,6); Fraction frac3B(6,9); cout << endl << "Comparing Fraction frac3A and frac3B = " << frac3A.PrintFrac() << " and " << frac3B.PrintFrac() << " gives a result of " << frac3A.compareto(frac3B)<