Rational number class

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ankitnasa
    New Member
    • Sep 2007
    • 1

    Rational number class

    Complete the following Java Class that may be used to represent a Rational number (i.e. a number of the form a /b where a and b are ints). Implement the constructors and methods to subtract, multiply and divide two Rational numbers. Also implement a toString method to allow the number to be written out. *Do not worry about simplifying your fractions (an answer of 2/4 is just as good as 1/2). Remember that fractions must not have denominators of zero.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by ankitnasa
    Complete the following Java Class that may be used to represent a Rational number (i.e. a number of the form a /b where a and b are ints). Implement the constructors and methods to subtract, multiply and divide two Rational numbers. Also implement a toString method to allow the number to be written out. *Do not worry about simplifying your fractions (an answer of 2/4 is just as good as 1/2). Remember that fractions must not have denominators of zero.
    What have you done so far?
    Have you read any basic tutorials yet?

    P.S I'm going to have to change your title to something more specific to the problem

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Those teachers don't have any imagination anymore nowadays; it's either the inventory
      assignment or the rational number program. Google must be full of solutions ...

      kind regards,

      Jos

      Comment

      Working...