the answer of Write a class for rational numbers. A rational number is quotient of two integers, such as 2/3 or 1/2. Your class should have three constructors. One constructor takes no argument, and initializes the rotational number to 0. Another constructor takes a numerator only (the denominator is assumed to be 1). The third constructor takes both a numerator and denominator. Your class should have methods for adding, subtracting, multiplying and dividing rational numbers.
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.