In trying to calculate a "cost" based on the area size, am getting a variable error after calling the calculate area method...any ideas on what is wrong here?
/**
* Method to calculate the area of the lawn
*/
public double calculateArea()
{
double area = 0;
area = lawnLength*lawnWidth;
return area;
}
/**
* Calculates the season charge based on the size of the lawn
*/
public String calculateCost()
{
calculateArea();
if(area < 400)
cost = 25*NUM_OF_WEEKS;
if(area > 400 || area < 600)
cost = 35*NUM_OF_WEEKS;
else
cost = 50*NUM_OF_WEEKS;
}
Thanks in advance!
/**
* Method to calculate the area of the lawn
*/
public double calculateArea()
{
double area = 0;
area = lawnLength*lawnWidth;
return area;
}
/**
* Calculates the season charge based on the size of the lawn
*/
public String calculateCost()
{
calculateArea();
if(area < 400)
cost = 25*NUM_OF_WEEKS;
if(area > 400 || area < 600)
cost = 35*NUM_OF_WEEKS;
else
cost = 50*NUM_OF_WEEKS;
}
Thanks in advance!