Display floating-point equivalent of each fraction object

Assignment Help Basic Computer Science
Reference no: EM131396255

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.

Reference no: EM131396255

Questions Cloud

Biased measure of the inflation rate : Why is there unemployment even when the economy is at "full employment"? What are some "costs of unemployment"? Is the CPI a biased measure of the inflation rate? Explain your answer.
What policy will result in the greatest income to authors : What policy will result in the broadest dissemination of high quality, peer-reviewed scholarly articles? What policy will result in the greatest income to authors
Biased measure of the inflation rate : Why is there unemployment even when the economy is at "full employment"? What are some "costs of unemployment"? Is the CPI a biased measure of the inflation rate? Explain your answer.
Unexpected exceptional performance of a company : After the unexpected exceptional performance of a company, all of its employees received a one-time bonus.  This led to a rightward shift of the demand curve for laptops manufactured by the company and a leftward shift of the demand curve for flas..
Display floating-point equivalent of each fraction object : Calculate the third Fraction to be the sum of the two entered Fractions. To sum fractions, you must find a common denominator.
What are the different streams of economics : What are the different streams of Economics and what are each of their's characteristics?
Discuss your personal public speaking background up : Discuss your personal public speaking background up to this point in your life/career. Explain how much you have OR have not had the opportunity to speak in public. Give examples.
What will happen to the equilibrium price : An unusually cold winter will mean consumers will demand more wool sweaters. What will happen to the demand curve? What will happen to the supply curve? What will happen to the equilibrium price? What will happen to the quantity sold?
Should athletes be allowed to use performance-enhancing drug : PHI103:Construct an argument for a position on the topic. This is the position that you will defend in your Final Paper. Make your argument as high quality as possible: In particular, make sure that all of your premises are true and that the truth..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd