# Thread: need help writing code for a java program, im beginner

1. Member
Join Date
Jan 2014
Posts
3
Rep Power
0

## need help writing code for a java program, im beginner

this is the problem and i have to do a program for it. can anyone help me. thankn ou

1. 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.

2. ## Re: need help writing code for a java program, im beginner

What do you need help with? Nobody will code it for you.

3. Member
Join Date
Jan 2014
Posts
3
Rep Power
0

## Re: need help writing code for a java program, im beginner

i know. i just need help on how to do it. do i use the int variable , double, or string.
i have

public class Land

{
public static void main(String [] args)
{
do i assign strings here and then use the system out print below to get what i want to output

System.out.println(

4. Member
Join Date
Jan 2014
Posts
30
Rep Power
0

## Re: need help writing code for a java program, im beginner

Java Code:
```public class LandCalculation{
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);
}
}```

5. Member
Join Date
Jan 2014
Posts
3
Rep Power
0

## Re: need help writing code for a java program, im beginner

thank you @ mbs. can you explain a bit how you did that if you don't mind. when you use the double and int do they have to be different i cant just uuse double or int. i have to use both

do i have to add more to this program

6. Member
Join Date
Jan 2014
Posts
30
Rep Power
0

## Re: need help writing code for a java program, im beginner

so basically ints and doubles are primitive data types... ints can only hold whole numbers though and doubles can hold decimals... google primitive data types to learn more :)

7. ## Re: need help writing code for a java program, im beginner

Originally Posted by mbschutlz97
Java Code:
```public class LandCalculation{
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);
}
}```
Please don't spoonfeed the OP.

kind regards,

Jos

8. Member
Join Date
Jan 2014
Posts
30
Rep Power
0

## Re: need help writing code for a java program, im beginner

Originally Posted by JosAH
Please don't spoonfeed the OP.

kind regards,

Jos
my bad

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•