Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can you help me to finish this cod in C++ main.cpp #include using namespace std; #include Rnumber.h int main() { const char HELP[] =

can you help me to finish this cod in C++

image text in transcribed

main.cpp

#include using namespace std; #include "Rnumber.h"

int main() { const char HELP[] = " The input can be entered in the form of" " a/b. (e.g. 1/2)" " " " The valid inputs given as:" " a + b addition (lowest terms)" " a - b subtraction (lowest terms)" " a * b multiplication (lowest terms)" " a / b division (lowest terms)" " a I inverse of a"

" a M mixed number of a" " a R lowest term" " a G greatest common divisor of a" " a L b lowest common denominator" " a b condition is true if a is greater than b" " a >= b condition is true if a is greater than or equal to b" " a = b condition is true if a is equal to b"; const char INVALID_INPUT[] = "*** Invalid input operation..Press h for help *** "; cout

if (cin.peek() == 'h') { cin.get(); cout

{ cin.get(); return 0; } else { Rnumber a, b; char op; cin >> a >> op; switch (op) { case '+': cin >> b; cout > b; cout > b; cout > b; cout

break; case 'i': case 'I': cout 0) cout > b; cout > op >> b; cout > b;

cout ': if (cin.peek() == '=') { cin >> op >> b; cout = b) ? "True" : "False") > b; cout b) ? "True" : "False") > b; cout > op; if (op == '+') { cin >> b >> op; if (op == '=') {

Rnumber c; cin >> c;

cout 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 numbers in the form a/b, a. except when bis 1, then it should just display a b. or when bis 0, then it should display #divo 3. The operations that should be implemented for the rational numbers are Result 13/24 15/24 Operator Addition Subtraction Multiplication Division Invert Mixed fraction Reduce Less than Less than or equal to Greater Than Greater than or equal Equal to Example 3/8 + 1/6 3/8-1/6 3/8 * 1/6 3/8 / 1/6 3/8 I 8/3 M 6/8 R 1/6 3/8 1/6 >= 3/8 3/8 == 9/24 1/16 9/4 8/3 2 and 2/3 3/4 True True False False True 4. The arithmetic 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 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 numbers in the form a/b, a. except when bis 1, then it should just display a b. or when bis 0, then it should display #divo 3. The operations that should be implemented for the rational numbers are Result 13/24 15/24 Operator Addition Subtraction Multiplication Division Invert Mixed fraction Reduce Less than Less than or equal to Greater Than Greater than or equal Equal to Example 3/8 + 1/6 3/8-1/6 3/8 * 1/6 3/8 / 1/6 3/8 I 8/3 M 6/8 R 1/6 3/8 1/6 >= 3/8 3/8 == 9/24 1/16 9/4 8/3 2 and 2/3 3/4 True True False False True 4. The arithmetic 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

Step: 3

blur-text-image

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions