Question: *please shows your init() method if you can, also will appreciate if u shows all the step in picture. 1. Add and update all class
*please shows your init() method if you can, also will appreciate if u shows all the step in picture.
1. Add and update all class constructors for your Fraction class to handle the initialization appropriately.
i. There must be as least 4 constructors of
ii. Default,
iii. Copy,
iv. Convert taking on an int.
v. One constructor with 2 arguments of int. The constructor should have code to confirm the call/use of itself through the printing (e.g., Calling Fraction(int, int)) and continue with the display of numerator and denominator after being initialized/built.
2. Provide get()/set() method members for each private data member.
3. Provide a method member print() that will print the current Fraction object.
B. Provide the following member methods,
a. A method add() to add a Fraction object; and
b. A method subtract() to subtract a Fraction object; and
c. A method multiply() to multiply a Fraction object; and
d. A method divide() to divide a Fraction object; and
C. Provide the following stand-alone (non-member) methods,
a. A method init() to set up or update the 3 required Fraction objects.
b. A method add() to add 2 Fraction objects; and
c. A method subtract() to subtract 2 Fraction objects; and
d. A method multiply() to multiply 2 Fraction objects; and
e. A method divide() to divide 2 Fraction objects; and
f. A method print() to print the required Fraction objects; and
g. An appropriate menuHw5() method to produce the required output as displayed below. Write a menu program to produce and display the output as specified as below,
********************* * MENU * *
1. Initializing *
* 2. Adding *
* 3. Subtracting *
* 4. Multiplying *
* 5. Dividing *
* 6. Printing *
* 7. Quit *
********************* Select an option (use integer value only): 6 Printing Option -- // To be discussed
********************* * MENU Hw #4 *
* 1. Initializing *
* 2. Adding *
* 3. Subtracting *
* 4. Multiplying *
* 5. Dividing *
* 6. Printing *
* 7. Quit *
********************* Select an option (use integer value only): 2
Adding Option -- Not a proper call as no Fractions are available!
********************* * MENU *
* 1. Initializing *
* 2. Adding *
* 3. Subtracting *
* 4. Multiplying *
* 5. Dividing *
* 6. Printing *
* 7. Quit *
********************* Select an option (use integer value only): 1 Initializing Option -- // To be discussed // - REPLACE WITH YOUR CODE AND ACTUAL OUTPUT
********************* * MENU *
* 1. Initializing *
* 2. Adding *
* 3. Subtracting *
* 4. Multiplying *
* 5. Dividing *
* 6. Printing *
* 7. Quit *
********************* Select an option (use integer value only): 6 PRINTING Option
******************************** * PRINTING MENU * *
(leftOp, rightOp, result) *
* 1. print() Member *
* 2. print() Stand Alone *
* 3. Return to Previous MENU *
******************************** Select an option (1, 2, or 3): 1 // To be discussed //
- REPLACE WITH YOUR CODE AND ACTUAL OUTPUT
******************************** * PRINTING MENU *
* (leftOp, rightOp, result) *
* 1. print() Member *
* 2. print() Stand Alone *
* 3. Return to Previous MENU *
******************************** Select an option (1, 2, or 3): 2 // To be discussed //
- REPLACE WITH YOUR CODE AND ACTUAL OUTPUT ********************************
* PRINTING MENU *
* (leftOp, rightOp, result) *
* 1. print() Member *
* 2. print() Stand Alone * * 3. Return to Previous MENU
*********************************
Select an option (1, 2, or 3): 3
********************* * MENU *
* 1. Initializing *
* 2. Adding *
* 3. Subtracting *
* 4. Multiplying *
* 5. Dividing *
* 6. Printing *
* 7. Quit *
********************* Select an option (use integer value only): 2 ADDING Option
******************************** * ADDING MENU * * * *
1. add() - Member *
* 2. add() Stand Alone *
* 3. Return to Previous MENU *
******************************** Select an option (1, 2, or 3): 5 WRONG OPTION ... ********************************
* ADDING MENU * * *
* 1. add() - Member *
* 2. add() Stand Alone *
* 3. Return to Previous MENU *
******************************** Select an option (1, 2, or 3): 1 Calling member add() // To be discussed //
- REPLACE WITH YOUR CODE AND ACTUAL OUTPUT ********************************
* ADDING MENU * * *
* 1. add() - Member *
* 2. add() Stand Alone *
* 3. Return to Previous MENU *
******************************** Select an option (1, 2, or 3): 2 Calling stand alone add() // To be discussed //
- REPLACE WITH YOUR CODE AND ACTUAL OUTPUT ********************************
* ADDING MENU * * *
* 1. add() - Member *
* 2. add() Stand Alone *
* 3. Return to Previous MENU *
******************************** Select an option (1, 2, or 3): 3 ********************* * MENU *
* 1. Initializing *
* 2. Adding *
* 3. Subtracting *
* 4. Multiplying *
* 5. Dividing *
* 6. Printing *
* 7. Quit *
********************* Select an option (use integer value only): 3 SUBTRACTING Option ********************************* * SUBTRACTING MENU * * *
* 1. subtract() - Member *
* 2. subtract() Stand Alone *
* 3. Return to Previous MENU *
********************************* Select an option (1, 2, or 3): 5 WRONG OPTION ... ********************************* * SUBTRACTING MENU * * *
* 1. subtract() - Member *
* 2. subtract() Stand Alone *
* 3. Return to Previous MENU *
********************************* Select an option (1, 2, or 3): 1 // To be discussed // - REPLACE WITH YOUR CODE AND ACTUAL OUTPUT // SELECT AND RUN OTHER OPTIONS // REPLACE WITH YOUR CODE AND ACTUAL OUTPUT *********************
* MENU *
* 1. Initializing *
* 2. Adding * * 3. Subtracting *
* 4. Multiplying * * 5. Dividing *
* 6. Printing * * 7. Quit *
********************* Select an option (use integer value only): 7
Having fun ...!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
