Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with this C++ program. Here are the instructions. Note that I have included a sample driver file and sample run at the

I need help with this C++ program. Here are the instructions. Note that I have included a sample driver file and sample run at the bottom. Please do not use any libraries other than iomanip and iostream, and also do not use either strings or structs. You can take your time, and either post pieces of the program and keep updating it, or let me know in the comments. Thanks a lot for your help.

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedHERE is the driver file. It is incomplete, which means that it does not test all conditions. You can use this to start off and add some more tests and calls.

image text in transcribedimage text in transcribed

And HERE is the sample run as an example.

image text in transcribed

Info: Create a class called Mixed. Objects of type Mixed will store and manage rational numbers in a mixed number format (integer part and a fraction part). The class should be in the header file, and the member functions definitions should be in another file 1. The class you create must allow for storage of rational numbers in a mixed number format (like 3 1/2 "three and The Mixed must allow for both positive and negative mixed number values. A zero in the denominator of the fraction part constitutes an illegal number and should not be allowed. You should create appropriate member data in your class. All member data must be private. 2. There should be two constructors. One constructor should take in three parameters, representing the integer part, the numerator, and the denominator (in that order), used to initialize the object. If the mixed number is to be a negative number, the negative should be passed on the first non-zero parameter, but on no others. If the data passed in is invalid (negatives not fitting the rule, or 0 denominator), then simply set the object to represent the value 0. Examples of declarations of objects: sets object to 3 4 5 Mixed ml (3, 4, 5) sets object to 4 1/2 Mixed m2 (-4, 1, 2); sets object to 3/5 integer part is 0 Mixed m3 (0, -3, 5) Mixed m 4 (-1, 2, bad parameter combination. Set object to 0 The other constructor should expect a single int parameter with a default value of 0 (so that it also acts as a default constructor). This constructor allows an integer to be passed in and represented as a Mixed object. This means that there is no fractional part. Example declarations: Mixed m5 (4) sets object to 4 (i.ee 4 and no fractional part) Mixed 6; sets object to 0 default Note that this last constructor will act as a "conversion constructor allowing automatic type conversions from type int to type Mixed

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions

Question

In an Excel Pivot Table, how is a Fact/Measure Column repeated?

Answered: 1 week ago