Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Fraction class with three private data fields for whole number, numerator, and denominator. i need this one include thanks in advance CST163 -

image text in transcribed
Create a Fraction class with three private data fields for whole number, numerator, and denominator. i need this one include
thanks in advance
CST163 - Programming in C++ Lab #8 Chapter #8 You have been developing a Fraction class for Teacher's Pet Software that contains several fields and functions A). Add two constructors to the class. The first accepts two integer values representing the numerator and denominator. If a single integer is passed to the constructor, use it as the numerator, and use a default value o are passed to the constructor, use a default value of 0 for the numerator and 1 for the denominator. When any Fraction is constructed with a 0 argument for the denominator, force the denominator value to 1. The second constructor requires three arguments: a whole number portion for a Fraction, a numerator, and a denominator. This constructor executes when any Fraction object is instantiated using three integer arguments. As with the other constructor, when any Fraction is constructed with a 0 argument for the denominator force the denominator value to 1. Whenever a Fraction object is constructed, automatically reduce the Fraction to the proper format. For example, a Fraction created using 0, 2, and 4 as arguments should be reduced to 1/2, and a Fraction created as 3 10/2 should be reduced to 8 0/1. Write a main() function that declares several Fraction objects, and confirm that the class works correctly

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

Online Market Research Cost Effective Searching Of The Internet And Online Databases

Authors: John F. Lescher

1st Edition

0201489295, 978-0201489293

More Books

Students also viewed these Databases questions

Question

explain the need for human resource strategies in organisations

Answered: 1 week ago

Question

describe the stages involved in human resource planning

Answered: 1 week ago