PDA

View Full Version : Noob Problem.

zero3xile
04-28-2006, 07:19 AM
ok guys im really new at java and just want some help in making this work

I basically need to Implement this pseudocode in java. This is basic program which just finds the total area of which i need to cut on the lawn. i need to calculate the area of the land and then subtract of from the area of the house. The problem is that i can't seem to figure out wat code i need to type. below is my identifer list.

IDENTIFIER - TYPE - DESCRIPTION
blockArea - Integer - total area of house block.
blockLength - Integer - length of the block.
blockWidth - Integer - width of the block.
houseArea - Integer - the area which the house occupies
houseLength - Integer - length of the house.
houseWidth - Integer - width of the house.
mowingArea - Integer - the area surrounding the house
mowingTime - Real - how long it takes to mowe the calculated mowingArea, consider in 1 minute they can mow 2 square meters.

I have constructed a basic algorithm as well..

Algorithm

Calculate_mowing_time
Prompt for blockLength, blockWidth
Get blockLength, blockWidth
blockArea = blockLength * blockWidth

Prompt for houseLength, houseWidth
Get houseLength, houseWidth
houseArea = houseLength * houseWidth

mowingArea = blockArea - houseArea
mowingTime = mowingArea / 2
Display mowingTime
END

If anyone here could help me out please in producing a code or atleast guiding me to a site which explains on how to produce calculations and promots then tat would be great. I also need to produce OO implementation driver but i may be able to do that later. thanks

Philip M
04-28-2006, 08:32 AM
Sounds like a homework assignment to me.
And Java is a completely different language to JavaScript, in spite of the confusingly similar names.

_Aerospace_Eng_
04-28-2006, 08:45 AM
Read your book. Look into declaring and initializing variables. You are using ints so it won't be hard. Prompting the user to enter input can be done in various ways. I find JOptionPane to be easiest but you probably haven't learned that yet. Look into System.in or the Scanner class to get user input if you want it from the DOS prompt. What book are you using anyways?