Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

INTRODUCTION: This is a C programming language. This is an exercise in simple cl

ID: 3923208 • Letter: I

Question

INTRODUCTION: This is a C programming language. This is an exercise in simple class implementation: constructors, accessors, and simple member functions. You will get a complete kit: Makefile, class header and implementation files, and a test file. DO NOT edit the header file.

MAIN QUESTION: Complete the class by implementing all the functions declared in rational.h file. HINT:start with just enough code to satisfy the compiler and linker such code will faill all the tests if you try to run the program. The tests in main() are organized in the order in which you should implement the code.

Rational.cpp: (Enter the code here)

rational.h file:

main.cpp file:

make file:

#include "rational-h" // Complete the class by implementing all the functions declared in // rational.h //Hint: start with just enough code to satisfy the compiler and linker // Such code will fail all the tests if you try to run the program. The // tests in main) are organized in the order in which you should implement // the code.

Explanation / Answer

Answer:

Rational(){

void setNumerator(){

num=1;

}

void setDenominator(){

den=1;

}

int getNumerator(){

return num;

}

int getNumerator(){

return den;

}

}

Rational(int n){

void setNumerator(){

num=n;

}

void setDenominator(){

den=1;

}

int getNumerator(){

return num;

}

int getNumerator(){

return den;

}

}

Rational(int n,int d){

void setNumerator(){

num=n;

}

void setDenominator(){

den=d;

}

int getNumerator(){

return num;

}

int getNumerator(){

return den;

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote