intermediate/Rational

From ggc

Jump to: navigation, search

01 package intermediate;
02 //start auto-imports
03 import java.awt.*;
04 //end auto-imports
05 
06 
07 /**
08  * All about my helper class.
09  @author My Name Here
10  */
11 public class Rational
12 {
13   private Point numbers;
14 
15   public Rational(int n, int d)
16   {
17     if(d==0)
18     {
19       numbers=new Point(01);
20     }
21     else
22     {
23       numbers=new Point(n, d);
24     }
25   }
26 
27   public double getValue()
28   {
29     return (double)numbers.x/numbers.y;
30   }
31 
32   public Point getPair()
33   {
34     //return numbers;
35     Point result=new Point(numbers.x, numbers.y);
36     return result;
37   }
38 
39   public int getDenominator()
40   {
41     return numbers.y;
42   }
43 
44   public static double getEpsilon()
45   {
46     return 1e-10;
47   }
48 }


Download/View intermediate/Rational.java





Views
Personal tools
Add to 
del.icio.usAdd to 
diggAdd to 
FacebookAdd to 
favoritesAdd to 
GoogleAdd to 
MySpaceAdd to 
PrintAdd to 
SlashdotAdd to 
StumbleUponAdd to 
Twitter