I'm sure some of you have seen this prompt before. I'm sure there's a simple solution but I'm very new to java and need assistance.
My prompt reads:
Assume that a gallon of paint covers about 350 square feet of wall space. Create an application with a main() method that prompts the user for the length, width, and height of a rectangular room. Pass these three values to a method that does the following:
-Calculates the wall area for a room
-Passes the calculated wall area to another method that calculates and returns the number of gallons of paint needed
-Displays the number of gallons needed
-Computes the price based on a paint price of $32 per gallon, assuming that the painter can buy any fraction of a gallon of paint at the same price as a whole gallon
-Returns the price to the main() method
The main() method displays the final price. For example:
You will need 2.0 gallons
The price to paint the room is $64.0
The error(s) I get:
PaintCalculator.java:15:
error: cannot find symbol
computeGallons(area);
symbol: variable area
location: class PaintCalculator
PaintCalculator.java:16: error: cannot find symbol
computeTotalCost(gallons);
symbol: variable gallons
location: class PaintCalculator
2 errors
Here is the code producing the error:
public class PaintCalculator
{
public static void main (String args[])
{
System.out.println("Please enter the length, width, and height of your rectangular room.");
Scanner input = new Scanner(System.in);
System.out.println("Enter length >>");
double length = input.nextDouble();
System.out.println("Enter width >>");
double width = input.nextDouble();
System.out.println("Enter height >>");
double height = input.nextDouble();
computeArea(length, width, height);
computeGallons(area);
computeTotalCost(gallons);
}
public static double computeArea(double length, double width, double height)
{
double area = (length * height * 2 + height * width * 2);
return area;
}
public static double computeGallons(double area)
{
double gallons = (area/350);
System.out.println("You will need " + gallons + " gallons");
return gallons;
}
public static double computeTotalCost(double gallons)
{
double totalCost = gallons * 32;
System.out.println("The price to paint the room is $" + totalCost);
return totalCost;
}
}