subject

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 denominator
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 "27/51.
an output function that displays the calling object in the terminal. The output should also be in the form of "2/3", i. e., numberator/denominator
One setter function that sets the numerator and denominator of the calling object.
Two getter functions that return the numerator and denominator respectively.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 12:30
An atom's diameter is about 0.1 nanometer (1Γ—10-9m), and a human hair is about 1Γ—10-3m. how many times greater is a human hair than an atom's diameter? sorry pushed wronf button but this is math
Answers: 3
question
Computers and Technology, 22.06.2019 14:00
Which database model is best used for data warehouse and data mining
Answers: 3
question
Computers and Technology, 24.06.2019 16:00
Which of the following characters is acceptable to use in a filename? ? / – %
Answers: 1
question
Computers and Technology, 24.06.2019 20:30
Drums installed, you would apply clicks of the parking brake to obtain a slight drag on both rear wheels
Answers: 1
You know the right answer?
This lab practices define class, more particular, identifying the member variables, declaring and de...
Questions
question
Mathematics, 12.03.2020 05:57
Questions on the website: 13722362