hi i need some help developing a rationaltest project in java.

package rationaltest;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class RationalDH extends Rational{
         // fields
        protected int top;
        protected int bottom;

        BufferedReader in = new BufferedReader(
                new InputStreamReader(System.in));
        public RationalDH(){
        public RationalDH(int numerator){
        public RationalDH(int numerator, int denominator){
        public RationalDH(Rational value){
        // accessor functions
        public int ceil(){
                // return numerator field of a Rational number
              if (denominator() == 1){
                //return top;
                //return bottom;
              return top;
        public int floor(){
                // return denominator field of a Rational number
                return bottom;
                //return top;
        public int div(){
          return top;
        public int mod(){
          return bottom;
        // assignments
        public RationalDH plusEquals(RationalDH right){
        // return sum of two Rational numbers and
        // assign value to this
                RationalDH result = new RationalDH(
                        this.ceil() * right.floor() +
                        right.ceil() * this.floor(),
                        this.floor() * right.floor());
                //this = result;
                top = result.ceil();
                bottom = result.floor();
                return result;
        // Greatest Common Divisor of a Rational number
        int gcd(){
                int n = top;
                int m = bottom;
                if (n==0){
                        return m;
                if (m==0){
                        return n;
                while (m!=n){
                        if (n>m){
                return n;
        public static void main(String args[]) {
          Rational r = new Rational(-3,4);
          RationalDH r1 = new RationalDH(7,3);
          System.out.println("Abs of "+ r +" equals " + r.abs());

What help - where's the question?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.