title: How to find the X-intercept of a slope in Java?
body: <p>I've never used Java, one of my programming friends gave me this to try and get used to Java. </p>
  
  <p>He gave me the test.java file along with some pointers for making the line class. However, I still don't know how to write code for the slope or y_int. I assume for vert I continue to use a Boolean and if/else statement but I am a bit lost.</p>
  
  <p>this is the Test.java:</p>
  
  <pre><code>public class Test {
      public static void main(String [] args ) {
  
          Line line[] = {new Line(5,4),
              new Line(0,2),
              new Line(5)};
  
          int i = 1;
          for(Line li : line){
              System.out.println("The x-intercept of line "+i+" is "+
                  li.getX_int());
              i++;
          }
      }
  }
  </code></pre>
  
  <p>this is the Line.java Class:</p>
  
  <pre><code>public class Line {
  
      public double slope;
      public double y_int;
      public double x_int;
      public boolean vert;
  
      public Line(double slope, double y_int){
          this.slope = slope;
          this.y_int = y_int;
          vert = false;
      }   
  
      public Line(double x_int) {
          slope = Double.NaN;
          y_int = Double.NaN;
          vert = true;
          this.x_int = x_int;
      }
  
      public double getSlope() {
          return slope;
      }
  
      public double getY_int() {
          return y_int;
      }
  
      public boolean isVert() {
          return vert;
      }
  }
  </code></pre>