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

``````package rationaltest;
import java.io.IOException;

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

public RationalDH(){
super();
}
public RationalDH(int numerator){
super(numerator);
}
public RationalDH(int numerator, int denominator){
super(numerator,denominator);
}
public RationalDH(Rational value){
super(value);
}
// accessor functions
public int ceil(){
// return numerator field of a Rational number
if (denominator() == 1){
//return bottom;
}
}
public int floor(){
// return denominator field of a Rational number
return bottom;
}
public int div(){
}
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){
n=n-m;
}else{
m=m-n;
}
}
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.