My method keeps returning 0
Hi I have the following two class files. How come my method keeps spitting out 0??? I can't for the life of me get it to calculate and display the length x height it always outputs zero?
Code:
public class UseJoe
{
public static void main(String[] args)
{
Joe boxH = new Joe();
Joe boxL = new Joe();
boxH.setHeight(55.5);
boxL.setLength(10.0);
//System.out.println("The width x height is: ");
Joe calcTotal = new Joe();
//calcTotal.computeBox();
double cTotal = calcTotal.computeBox();
System.out.println("The width x height is: " + cTotal);
}
}
And the other class
Code:
public class Joe
{
private double length;
private double height;
public double getLength()
{
return length;
}
public void setLength(double l)
{
length = l;
}
public double getHeight()
{
return height;
}
public void setHeight(double h)
{
height = h;
}
double computeBox()
{
return height * length;
}
}