Homework Help - Conductors & Methods

Hi:

I'm in a Java online course. I am completely lost on a homework problem and cannot proceed, since I don't have my Java textbood to refer off of anymore (accidentally left it in another state). Any suggestions on how to start? I can't seem to find any help online. Here is the problem.

------------------------------------------------------------------------------------------------------------------------

Write and fully test a class that represents rational numbers. A rational number can be represented as the ratio of two integer values, ( a ) and ( b ), where ( b ) is not zero. The class has attributes for the numerator and denominator of this ratio. The ratio should always be stored in its simplest form. That is, any common factor of ( a ) and ( b ) should be removed. For example, the rational number 40/12 should be stored as 10/3.

The class has the following contructors and methods:

* A default constructor that sets the rational numbers to 0/1

* A constructor that has parameters for the numerator and denominator and converts the resulting ratio to simplified form.

* simplify--a private method that converts the rational numbers to simplified form.

* geGCD (x, y )--a private static method that returns the largest common factor of the two positive integers x and y, that is, their greatest common divisor. For example, the greatest common divisor of 40 and 12 is 4.

* getValue--returns the rational number as a double value.

* toString--returns the rational number as a string in the form a/b.

------------------------------------------------------------------------------------------------------------------------

//Here is what I currently have... like I said, it's hard for me to proceed without my book. How would I even begin? I am completely lost. Much help is appreciated!!

import java.util.Scanner;

public class rational

{

Re: Homework Help - Conductors & Methods

First off, it's constructor, not conductor. And secondly, who needs a textbook when you have the tutorials? The Java™ Tutorials

Re: Homework Help - Conductors & Methods

First, thanks to KevinWorkman for an excellent link. A favorite reference of mine.

Second, please see the announcements page for the use of code tags and other forum tips.

I think with a choice of the many search engines, and keywords "java hello world" you can get a bit more code than provided in the op.