Java Error

I have a simple java program with an error on line 14 and the code looks fine. What am I missing?

public class Carpet
//  This application performs arithmetic with two integers
{
  public static void main(String[] args)
  {
    int carpetLength = 14;
    int carpetWidth = 11;
      double carpetPrice = 3.75;
    System.out.print("Length of the carpet is " + carpetLength);
      System.out.println("ft");
      System.out.print("Width of the carpet is " + carpetWidth);
      System.out.println("ft");
      System.out.println("Price for square foot is $" + carpetPrice);
      product = carpetLength * carpetWidth;
      System.out.println("Cost for carpeting the room is $" + product * carpetPrice);
  }
}
dynamicOneAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
You need to inform Java of what "type" your product variable should be, try this...
int product = carpetLength * carpetWidth;

Open in new window

In Java, all variables need to be declared before they can be used.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dynamicOneAuthor Commented:
Thank you, I appreciate it!
0
mccarlIT Business Systems Analyst / Software DeveloperCommented:
Not a problem, glad to help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.