Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

General Description: A rational number is of the form a/b, where a and b are integers, and b is not equal 0. Develop and test

General Description: A rational number is of the form a/b, where a and b are integers, and b is not equal 0. Develop and test a class for processing rational numbers. Details: 1. Your program should have 3 files: a driver file to test the operations, a header file for the class definition and any operator overloads you need, and an implementation file with the definitions of the items in the header file.

2. The class should read and display all rational number results in the form a/b, a. except when b is 1, then it should just display a b. or when b is 0, then it should display #div0 c. all results should be reduced to lowest terms i. (i.e., 2/4 should be displayed as 1/2)

3. The operations that should be implemented for the rational numbers are Operator Example Result Addition 3/8 + 1/6 13/24 Subtraction 3/8 1/6 5/24 Multiplication 3/8 * 1/6 1/16 Division 3/8 / 1/6 9/4 Less than 1/6 < 3/8 True Less than or equal to 1/6 <= 3/8 True Greater Than 1/6 > 3/8 False Greater than or equal 1/6 >= 3/8 False Equal to 3/8 == 9/24 True

4. All the operators must be overloaded to work with the class

5. The class must have a. At least 2 private member variables, numerator and denominator

b. At least 4 public member functions i. getNum(), getDen(), setNum(value), setDen(value)

6. You must have internal documentation: See the handout on Documentation Standards

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi

13th Edition Global Edition

1292263350, 978-1292263359

More Books

Students also viewed these Databases questions

Question

Find the indicated term for each sequence. an = (n + 1)(2n + 3); ag

Answered: 1 week ago

Question

Question What is a Roth 403 (b) plan?

Answered: 1 week ago

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago