You are developing a Fraction structure for Teacher’s Pet Software. The structure contains three public data fields for whole number, numerator, and denominator. Using the same structure, write the functions described below: • An enterFractionValue()function that declares a local Fraction object and prompts the user to enter values for the Fraction. Do not allow the user to enter a value of 0 for the denominator of any Fraction; continue to prompt the user for a denominator value until a valid one is entered. The function returns a data-filled Fraction object to the calling function. • A reduceFraction()function that accepts a Fraction object and reduces it to proper form, returning the reduced Fraction. For example

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

You are developing a Fraction structure for Teacher’s Pet Software. The structure contains three public data fields for whole
number, numerator, and denominator. Using the same structure, write the functions described below:
• An enterFractionValue()function that declares a local Fraction object and prompts the user to enter values
for the Fraction. Do not allow the user to enter a value of 0 for the denominator of any Fraction; continue to
prompt the user for a denominator value until a valid one is entered. The function returns a data-filled
Fraction object to the calling function.
• A reduceFraction()function that accepts a Fraction object and reduces it to proper form, returning the
reduced Fraction. For example, a Fraction entering the function as 0 2/6 would be reduced to 0 1/3, and a
Fraction entered as 4 18/4 would be reduced to 8 1/2.
• A displayFraction()function that displays any Fraction object passed to it. This function displays a fraction
with a slash between the numerator and denominator.
• A main()function that declares a Fraction object and continues to get Fraction values from the user until the
user enters a Fraction with value 0 (both the whole number and the numerator are 0). For each Fraction
entered, display the Fraction, reduce the Fraction, and display the Fraction again.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 4 images

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education