Question: I needed a solution for this C++ question. Please use C++ only. A. Update the Fraction class given in the Lecture notes or as discussed
I needed a solution for this C++ question. Please use C++ only.
A. Update the Fraction class given in the Lecture notes or as discussed in class meetings as follows, 1. Add your FIRST NAME and the initial of your last name to the name Fraction and use this as your updated class. For examples, if your first name is John Smith then update the class name to be FractionJohnS. 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; and (ii) Copy; and (iii) Fraction(int n, int d) Each constructor should print the confirmation (e.g., Calling Fraction(), Calling Fraction(const Fraction&), or Calling Fraction(int, int)). 3. Provide a destructor with a confirmation when removing the object (i.e., Calling ~Fraction()). 4. Provide get()/set() member functions for each private member data. 5. A member function print() that will print the current Fraction object. B. Provide the following member functions, a. A member function isPalindrome(), which is a predicate, to return true/false if the Fraction object is a Palindrome; and b. A function displayCommonPalindromeDigit(); and c. A gcd() helper to reduce the Fraction object; and C. Provide the following stand-alone functions, d. A function init() to set up or update the required Fraction object. e. An appropriate runMenuHw3() function to produce the required output as displayed below; and f. Other functions as needed. C. Run a driver/program named as cis25spring2021YourNameHw3.cpp and record the output shown below. (a) The output screen should have the following lines displayed before any other display or input can be seen, CIS 25 C++ Programming Laney College YourName Information -- Assignment: HW #3 Exercise #1 Implemented by: YourName Submitted Date: 2021/03/15 Current Number of LEB available: ? Allowed Number of LEB Used: ? Remaining Number of LEB: ? (b) Then, the output screen should be followed by a sample output as follows, ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 6 WRONG OPTION! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 2 Palindrome Option -- Not a proper option as there is no Fraction! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 1 INITIALIZING Option Calling runMenuInit()! ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 2 Not a proper option as there is no Fraction! ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 5 WRONG OPTION! ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 1 Creating 1 NEW Fraction object - Calling create()! Enter num: 5 Enter denom: -959 ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 3 Returning to previous menu! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 4 PRINTING Option -- Address : 0041FDD4 num : -5 denom : 959 ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 2 Palindrome Option The current Fraction is a Palindrome! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 3 displayCommonPalindromeDigit() Option There is/are 1 common digit(s) of 5 ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 1 INITIALIZING Option Calling runMenuInit()! ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 2 Updating an EXISTING Fraction object - Calling update()! Enter num: 156810000 Enter denom: 49914173 ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 3 Returning to previous menu! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 4 PRINTING Option -- Address : 0041FDD4 num : 156810000 denom : 49914173 ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 2 Palindrome Option The current Fraction is not a Palindrome! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 3 displayCommonPalindromeDigit() Option The current Fraction is not a Palindrome! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 1 INITIALIZING Option Calling runMenuInit()! ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 1 Please update or return! ************************** * SubMENU INITIALIZING * * 1. Creating * * 2. Updating * * 3. Returning * ************************** Select an option (integer only): 3 Returning to previous menu! ******************************************** * MENU HW #3 * * 1. Initializing * * 2. isPalindrome() * * 3. Using displayCommonPalindromeDigit() * * 4. Printing * * 5. Quit * ******************************************** Select an option (use integer value only): 1 Having fun ...!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
