Here is the program that you will find on page 139 in the textbook. To make this run you will have to right click on the name of your project, click on "properties" in the menu, then click on "libraries" in the next menu, remove the reference to "sedgewick-wayne.jar" and then "Add Jar file" and specify where your copy of "sedgewick-wayne.jar" is.
Create a NetBeans project named "rational." Copy the contents of this file into the project. Reorder the lines of code. If NetBeans does not put it there for you automatically, you will have to add a package statement at the top of the Rational.java file: "package rational;"