# hi, beginner. need help with code

• January 27th, 2014, 11:58 PM
kittykat0953
hi, beginner. need help with code
hi i am a total beginner at java code.
i am trying to write a program for this problem.

Land Calculation

One acre of land is equivalent to 43,560 square feet. Write a program
that calculates the number of square feet in a tract of land with 3.5
acres. Hint: Multiply the size of the tract of land (in acres) by the
number of square feet in an acre to get the number of square feet in
the tract.

a) You must have a variable called nrAcres where you will store the
number of acres in the track.

b) Output must look as follows:

Size of land in acres: 3.5
Size of land in square feet: 152460

c) if the value of the variable nrAcres is changed the output should
change accordingly. In other words: it would be wrong to have the
following statement:

System.out.println("Size of land in square feet: 152460");

previous statement will print the correct output but will not change
if you change the value of nrAcres.

this is what i got so far

public class Land
{
public static void main(String[] args){
double nrAcres = 3.5;
int feetInAcre = 43560;
double feetInTract = nrAcres * feetInAcre;
System.out.println("Size of land in acres: " + nrAcres + "\nSize of land in square feet: " + feetInTract);
}
}

i tried to compile it but it says

error: class names, Land, are only accepted if annotation is explicitly requested 1 error

what is wrong with my code
• January 28th, 2014, 01:18 AM
Ganeprog
Re: hi, beginner. need help with code
Hi,

I think you missed ".java" at the time compilation. Try to complile like this "javac Land.java" and run the program "java Land"

Still you have any difficulties post here.we are happy to help you:o:cool:

thanks,
• January 28th, 2014, 02:27 AM
PhHein
Re: hi, beginner. need help with code
Crossposted: need help writing code for a java program, im beginner
The code was spoonfed.
• January 28th, 2014, 04:53 AM
GregBrannon
Re: hi, beginner. need help with code
Welcome to the Forum! Please read this topic to learn how to post your code correctly along with other useful info for newcomers.