Question: Please help! Thank you! This lab practices define class, more particular, identifying the member variables, declaring and defining constructors, and other member functions. Background reading

Please help! Thank you!  Please help! Thank you! This lab practices define class, more particular,
identifying the member variables, declaring and defining constructors, and other member functions.
Background reading Please review textbook for the basics of class, and the

This lab practices define class, more particular, identifying the member variables, declaring and defining constructors, and other member functions. Background reading Please review textbook for the basics of class, and the idea of Abstract Data Type (Section 10.2 and 10.3 in Savitch). This project is adapted from the Project 7 in Page 614 of Savitch book. Requirement Write a rational number class. Recall a rational number is composed of two integers with division indicated. The division is not carried out, it is only indicated, as in 1/2, 2/3, 15/32. You should represent rational numbers using two int values, numerator and A principle of abstract data type construction is that constructors must be present to create objects with any legal values. You should provide the following three constructors 1. one (default) constructor to make rational object without any argument. The constructor sets the rational object's numerator to 0, and denominator to 1 2. one constructor with two int parameters. This constructor uses the two values to initialize the rational object's numerator and denominator respectively. If the denominator value is 0, the constructor should generate an assertion failure 3. one constructor with one int parameter. The constructor should set the rational's numerator to the given parameter, and sets the denominator to 1 You should also provide the following member functions . an input function that reads from standard input the value for the calling object. The input should be in the form of "2/3" or 27151. an output function that displays the calling object in the terminal. The output should also be in the form of "2/3, i.e. One setter function that sets the numerator and denominator of the calling object. Two getter functions that return the numerator and denominator respectively

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!