1. Rational
    Implement a rational number class: Rational
    Augment your class with methods for:
    a) Initialization (Constructor): parameters are numerator and denominator as integers. You must have 3 constructors as follows
     No Parameters: 0 / 1
     One Parameter (x): x / 1
     Two Parameters (x, y): x / y
    b) float getValue(): returns the value of the number
    c) [bonus]Rational add(Rational r): adds to another rational number
    All your numbers should be saved in Reduced Form
    Augment your code with a driver class (that contains "main" method) that constructs two Rational numbers, get the average of the two numbers and prints it on the screen.
Votes + Comments
try something..then ask question..
5 Years
Discussion Span
Last Post by jalpesh_007

i want an answer to this problem because i donot know how to solve it ... but i want the answer quickly please

Edited by ahmedhesham: i want to add something to the reply


what have you got so far? this is just an assignment. we will help you correct your mistakes, but we're not going to write it for you.


As stultuske said: first try to write something,and if there are any problem. we're here to help you.

First do some work.


There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you.

DaniWeb Member Rules (which you agreed to when you signed up) include:
"Do provide evidence of having done some work yourself if posting questions from school or work assignments"

Post what you have done so far and someone will help you from there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.