This programming assignment is designed to teach how to write and use a fairly simple C++ class. The program needs a class called Rational. Its objects will be rational numbers. A rational number is a number of the form a/b where a and b are integer numbers (examples: 1/2, 17/45, 2/79). It needs to represent rational numbers as two private values of type int. One will be the numerator of the rational number and the other the denominator. Have to write two constructors for the class, one with no arguments (default constructor) and the other one with two arguments, used to initialize the member variables of an object in Rational. The default constructor initializes the rational number to 0 (that is numerator=0 and denominator=1). The class will also comprehend the two accessory functions get_num and get_den that return the value of numerator and denominator of a given rational number respectively and the set_num and set_den that set the value of numerator and denominator. The program gets the input from the screen and gives output both to the screen and the output file output.dat. Here's an example of screen output: ***** Rational numbers calculator ***** Be ready to enter numbers and operations in the format: 1/2 + 1/4 for the sum, 1/3 * 1/7 for the product. Operations are performed one at a time. Complete output appears in the file [url removed, login to view] 1/2+2/3 1/2+2/3=7/6 Would you like to do another computation? (y/n)y 1/4+3/2 1/4+3/2=14/8 Would you like to do another computation? (y/n)y 3/4*4/7 3/4*4/7=12/28 Would you like to do another computation? (y/n)n The file [url removed, login to view] will contain: 1/2+2/3=7/6 1/4+3/2=14/8 3/4*4/7=12/28 Not responsible for any input error. Notice that the result appears not in the simplified form (i.e., 14/8 should be 7/4, 12/28 should equal 6/7). Make the result appear simplified, that is in the form p/q where p and q have no common factors. It is required to use a minimum of 5 functions (not including the member functions).
1) Complete and fully-functional working program(s) in executable form as well as complete source code of all work done (i.e., .exe and .cpp files). 2) Installation package that will install the software (in ready-to-run condition) on the platform(s) specified in this bid request. 3) Complete ownership and distribution copyrights to all work purchased.
All Windows platforms (95/98/2000/NT/Me/XP)