Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In earlier chapters, you developed a Fraction structure for Teachers Pet Software. The structure contains three public data fields for whole number, numerator, and denominator.

In earlier chapters, you developed a Fraction structure for Teachers Pet Software. The structure contains three public data fields for whole number, 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 for two of the Fractions. Add statements to the main()function to do the following:

Do not allow the user to enter a 0 denominator for any Fraction; continue to prompt the user until an acceptable denominator is entered.

Reduce each Fraction to proper fraction form and display it. For example, the following table shows some user entries and the output you should display.

Prompt the user to enter an arithmetic operation: + or *. Calculate the third Fraction to be the result of applying the requested operation to the two entered Fractions. Display the result as a whole number, if any, and the fractional part, if any. Reduce the result to proper form. For example, adding 1/4 and 1/4 results in 1/2, adding 3/4 and 3/4 results in 1 1/2, subtracting 1/5 from 3/1 results in 2 4/5, and multiplying 1/3 by 6/1 results in 2.

Any coding assignments will have to be submitted in .cpp format and a Word document with the code copy/pasted and screenshots of the output.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Upgrading Oracle Databases Oracle Database New Features

Authors: Charles Kim, Gary Gordhamer, Sean Scott

1st Edition

B0BL12WFP6, 979-8359657501

More Books

Students also viewed these Databases questions

Question

What is meant by planning or define planning?

Answered: 1 week ago

Question

Define span of management or define span of control ?

Answered: 1 week ago

Question

What is meant by formal organisation ?

Answered: 1 week ago

Question

What is meant by staff authority ?

Answered: 1 week ago