Output is all wrong.
When first starting program it should look like this:
Please enter two non-zero integers:
then I type in these two integers 14 6 and hit enter.
The next line says:
Please enter Rational number:
Then I type in this Rational number (22, 4) and hit enter.
The output should be these lines:
Test1 equals (7, 3)
Test2 equals (14, 1)
Test3 equals (11, 2)
Test1 * Test2 equals (98, 3)
Test1 / Test3 equals (14, 33)
Test2 + Test3 equals (39, 2)
Test3 - Test1 equals (19, 6)
Test1 is less than Test2
Test2 is greater than Test3
Test3 is greater than or equal to Test1
Another test case?
Note that program has to ignor parentheses ( ) and the comma , .
All of the operators required in the problem should be provided for the Rational class as overloaded, Friend functions. In general, you should be able to execute code such as following:
// Display the three values to test cout
cout << "\nTest1 equals " << test1;
cout << "\nTest2 equals " << test2;
cout << "\nTest3 equals " << test3;
// Test our operators
cout << "\nTest1 * Test2 equals " << test1*test2;
cout << "\nTest1 / Test3 equals " << test1/test3;
cout << "\nTest2 + Test3 equals " << test2+test3;
cout << "\nTest3 - Test1 equals " << test3-test1;
if (test1 == test2)
cout << "\nTest1 is equal to Test2";
if (test1 < test2)
cout << "\nTest1 is less than Test2";
The above code has to be in. And a Friend function has to be used.
I start my code but it is all wrong. So I included the code I did along with the instructions.
How see it going
Download answer from here: Rational.cpp
Please let me know if anything else is required in this.
All most perfect. Thank You.
the end of the program end with:
and if I type y for yes it will go back to first line:
You will start with the source code files of Displays 12.1 and 12.2, which I have attached to this lesson’s Contact as dtime.h and dtime.cpp. You'll update the class (please keep those same file names), adding the new interval_since member function, then write a test program that exercises the updated class. I want the test program to exercise all of:Both constructorsThe overloaded >> operatorThe overloaded << operatorThe overloaded == operatorThe advance member functionThe new interval_since member function
The files below must have new interval_since function and it must exercise all of
Both constructorsThe overloaded >> operatorThe overloaded << operatorThe overloaded == operatorThe advance member functionThe new interval_since member function
Once I reply on that page, you can copy paste the question
Go to following link
to create the question under my profile
I paid for an assignment last week so I have a credit. that why I asking now.
So how do I use my credit?