I am ask to write a class for rational numbers. A rational number is quotient of two integers, such as 2/3 or ½. Your class should have three constructors. One constructor takes no argument, and initializes the rational 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. Keep in mind that before adding or subtracting rational numbers, the denominators must be the same in both numbers. Ideally, your class should also convert all results to the smallest numerator and denominators. For example, if a result yields 4/8, your class should convert it to ½. Write a program that shows that all methods in the Rational class work as they should.
Belows are my code and i am stuck here, actully i am the kind of person that not too smart to think logicall, if you r willing to help me, can u give me a hint that is clear enough for me to understand. Thank u very much
public class rationalNumbers {
/**
* @param args
*/
public static void main(String[] args) {
int a;
}
class Rational{
int num=0;
Rational(){
}
Rational(int a){
}
Rational (int a,int b){
}
}
}