title: Right Triangle calculations returning 0?
body: <p>I can't figure out what I am doing wrong here. I just wrote a similar code that worked fine. once I got a handle on how to use the scanner class. I am working on a program that takes the height and base of a right triangle and then calculates the perimeter, area, and hypotenuse. But it returns 0.0 for each method and I can't figure out if I am missing some sort of syntax or if I am just really messing up my calculations. Can someone just point me in the right direction of my mistake?</p>
  
  <pre><code>    public class RightTriangle {
  
      private double height;
      private double base;
      private final double hypotenuse = Math.sqrt(Math.pow(height, 2) + Math.pow(base, 2));
  
     public RightTriangle(double triHeight, double triBase)
     {
         triHeight = height;
         triBase = base;
     }
  
     public double getPerimeter()
     {
         double perimeter = height + base + hypotenuse;
         return perimeter;
     }
  
     public double getArea()
     {
         double area = (height + base) / 2;
         return area;
     }
  
     public double getHypotenuse()
     {
         return hypotenuse;
     }
  }
  </code></pre>
  
  <p>Here is my main method:</p>
  
  <pre><code>    import java.util.Scanner;
  
      public class CalculateTriangle 
  {
  
      public static void main(String[] args)
      {
          Scanner triangleHeight = new Scanner(System.in);
          System.out.print("Enter Triangle Height: ");
          double height = triangleHeight.nextDouble();
  
          Scanner triangleBase = new Scanner(System.in);
          System.out.print("Enter Triangle Base: ");
          double base = triangleBase.nextDouble();
  
          RightTriangle newTriangle = new RightTriangle(height, base);
  
          newTriangle.getPerimeter();
          double perimeter = newTriangle.getPerimeter();
  
          newTriangle.getArea();
          double area = newTriangle.getArea();
  
          newTriangle.getHypotenuse();
          double hypotenuse = newTriangle.getHypotenuse();
  
          System.out.println(perimeter);
          System.out.println(area);
          System.out.println(hypotenuse);
  
      }
  }
  </code></pre>