INTRODUCTION This is a C programming language This is an exe
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.Solution
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;
}
}

