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, 23.06.2019 00:30
Pl i need the answer now ! which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Adrawing that places all lines parallel to the z axis at an angle from the horizon is 99 ! a. an oblique drawing b. a perspective drawing c. an auxiliary view d. a one-point perspective drawing
Answers: 2
question
Computers and Technology, 24.06.2019 08:00
Can someone work out the answer as it comes up in one of my computer science exams and i don't understand the cryptovariables
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Read these lines from beowulf.often scyld scefing seized mead-benches from enemytroops, from many a clan, he terrified warriors, even thoughfirst he was found a waif, best explains why the author includes this information in theexposition? a. to emphasize that a hero must learn to be fierceb. to remember the famous story of a popular heroc. to express sadness about losing the old heroesd. to see whether people still respect the old heroes
Answers: 1
You know the right answer?
This lab practices define class, more particular, identifying the member variables, declaring and de...
Questions
question
Mathematics, 05.07.2019 17:10
Questions on the website: 13722367