The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 407 Weeks Ago, 6 Days Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
CASE PROJECT 1Â Â Â Â Â Â Â Â Â Â Â
Â
In Chapter 1 you developed a Fraction structure for Teacher’s Pet Software. The structure contains two public data fields for numerator and denominator. Using the same structure, write a main()function in which you create three Fraction objects. Prompt the user for values for each field of two of the Fractions. Add statements to the main()function to do the following:
Â
» Display the floating-point equivalent of each Fraction object. For example, the floatingpoint equivalent of 1/4 is 0.25.
Â
» Calculate the third Fraction to be the sum of the two entered Fractions. To sum fractions, you must find a common denominator. You can do this by multiplying each operand Fraction’s numerator and denominator by the denominator of the other Fraction, using the common denominators, and adding the numerators. For example, to create a Fraction that is the sum of 2/5 plus 1/6, you do the following:
Â
1. Multiply the numerator and denominator of 2/5 by the denominator of the second Fraction, 6, giving 12/30.
Â
2. Multiply the numerator and denominator of 1/6 by the denominator of the first Fraction, 5, giving 5/30.
Â
3. Add the numerators and use the common denominator, giving 17/30.
Â
Display the result. You do not need to reduce an improper Fraction result. For example, when you add 1/2 and 1/4, the result can be displayed as 6/8 instead of being reduced to 3/4.
Â
Â
Â
Â
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------acq-----------uis-----------iti-----------on -----------of -----------my -----------pos-----------ted----------- so-----------lut-----------ion-----------.Pl-----------eas-----------e p-----------ing----------- me----------- on-----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be-----------