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, 24.06.2019 00:00
Which tool could be used to display only rows containing presidents who served two terms
Answers: 3
question
Computers and Technology, 24.06.2019 02:20
The first time a user launches the powerpoint program, which view is shown allowing the user to access recent presentations or create new presentations based on templates?
Answers: 1
question
Computers and Technology, 24.06.2019 21:30
How is a wan different than a lan? both connect computers, but only wan users don’t need the same operating system. both are peer-to-peer networks, but only a wan requires networking hardware. both network computers, but only a wan can cover larger geographical ranges. both connect computers to the internet, but only wan connects to the cloud.
Answers: 1
question
Computers and Technology, 24.06.2019 22:00
According to your study unit, what is the main reason that improved human relations skills may improve your grades?
Answers: 1
You know the right answer?
This lab practices define class, more particular, identifying the member variables, declaring and de...
Questions
question
Mathematics, 14.10.2019 02:10
question
Mathematics, 14.10.2019 02:10
Questions on the website: 13722360