- Joined
- Jul 12, 2008
- Messages
- 303
- Reaction score
- 3
Code:
Update the Fraction class given in the Lecture notes or as discussed in class meetings as follows,
1. Add your FIRST NAME to the name Fraction and use this as your updated class. For examples, if your first name is John then update the class name to be JohnFraction; if your first name is Smith then update the class name to be SmithFraction.
2. Add and update all class constructors for your fraction class to handle the initialization appropriately.
There must be as least 3 constructors of
(i) default,
(ii) copy, and
(iii) convert taking on an int.
3. Provide all get/set member functions for each private member data.
4. Provide the following member functions,
a. A member function add() to add the current fraction to a fraction given as an argument, and
b. A member function subtract( ) to subtract a fraction given as an argument from the current fraction, and
c. A member function multiply( ) to multiply the current fraction with a fraction given as an argument, and
d. A member function divide( ) to divide the current fraction by a fraction given as an argument , and
e. A member function print() that will print the resulting fraction(s).
5. Save the program as cis25Fall2009YourNameLab5CodeEx1.cpp,
6. Run and record the output of the program.
(a) The output screen should have the following lines displayed before any other display or input can be seen,
Assignment Information --
Assignment Number: Lab 6,
Exercise #1
Written by: Your Name
Due Date: Due Date
(b) Then, the output screen should be followed by a sample output as follows,
CREATE SOME REASONABLE FRACTION(S) HERE FIRST
***************************
* MENU *
* *
* 1. Calling add() *
* 2. Calling subtract() *
* 3. Calling multiply() *
* 4. Calling divide() *
* 5. Calling print() *
* 6. Quit *
* *
***************************
Select an option (use integer value only): 5
Calling print() –
REPLACE WITH YOUR CODE AND ACTUAL OUTPUT
***************************
* MENU *
* *
* 1. Calling add() *
* 2. Calling subtract() *
* 3. Calling multiply() *
* 4. Calling divide() *
* 5. Calling print() *
* 6. Quit *
* *
***************************
Select an option (use integer value only): 1
Calling add() –
REPLACE WITH YOUR CODE AND ACTUAL OUTPUT
Does anyone have any idea of how to start? >.< I have the header file, and stuff, but kinda confused what to put inside the header.

