Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92206070

Have any Question?


Related Questions in Computer Engineering

Question suppose that someone tells you that an attribute

Question : Suppose that someone tells you that an attribute that is part of a composite primary key is also a candidate key. How would you respond to that statement? Explain.

One of the issues in early virtualization use was slow

One of the issues in early virtualization use was slow performance due to translation of system commands. Which piece of computer hardware was revised to run hypervisors natively? Also There are three "families" of opera ...

Given an undirected graph with both positive and negative

Given an undirected graph with both positive and negative edge weights, design an algorithm to find a maximum spanning forest with the largest total edge weights.

The of the steering wheel is used to create a parallel

The _____ of the steering wheel is used to create a parallel plane in the Synchronous Part environment. The _____ option is used to apply the crown by defining its radius and take-off angle. 1-In the Ordered Part environ ...

Question research analyze and discuss the advantages and

Question : Research, analyze, and discuss the advantages and disadvantages of Web-based collaboration tools. Compare and contrast Google Apps and Microsoft SharePoint. The response must be typed, single spaced, must be i ...

Birth weights of full-term babies in a certain area are

Birth weights of full-term babies in a certain area are normally distributed with mean 7.13 pounds and standard deviation 1.29 pounds. A newborn weighing 5.5 pounds or less is a low-weight baby. What is the probability t ...

Question suppose you transferred three packets each

Question : Suppose you transferred three packets each containing 1000 bytes of data from one system to another. The entire process took 1 minute and 20 seconds. What is the data rate (bits/sec) of this transmission? Can ...

Requirementsin this assignment you will implement a

Requirements In this assignment, you will implement a lightweight version of an ArrayList class. You may refer to the Java code and documentation for guidance, but you must write the implementation yourself. Additionally ...

Suppose that we need to send four packets a b c d from a

Suppose that we need to send four packets (A, B, C, D) from a sender to a receiver. Consider two cases. 1) packet B is lost. 2) acknowledgement for packet B is lost. When there is a packet loss, always assume that only t ...

Question suppose a problem can be solved with two different

Question : Suppose a problem can be solved with two different algorithms, A or B. Algorithm A has a time complexity of TA = 17n, and algorithm B has a time complexity of TB = 0.5n 2 . Give the range of n for which it is ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As