This site requires JavaScript, please enable it in your browser!
Greenfoot back
javastudent
javastudent wrote ...

2016/1/9

Show distance

javastudent javastudent

2016/1/9

#
Hi. How do you find the distance of two variables and then show it to the user? And also the method should be able to accept four arguments and returns the distance of the two variables. The user is supposed to type two variables when he/she presses a. HELP PLEASE THANK YOU.
Super_Hippo Super_Hippo

2016/1/9

#
Distance of two variables. What do you mean with variables? Do you mean two objects in the world and calculate the distance or do you have two numbers and want to get the difference? The method should accept four arguments (=numbers?) and calculate the distance of which of the four? When user pressed 'a' is just:
if ("a".equals(Greenfoot.getKey()))
{
    //...
}
javastudent javastudent

2016/1/10

#
The user will input two numbers from the cartesian plane and it has to show the distance of the two numbers. And the method should accept four arguments and has to return the distance of the two numbers. Sorry if it made you confuse. Help. Thank you
danpost danpost

2016/1/10

#
Numbers do not have distances and planes do not have numbers. Numbers have differences and planes have points. Points use two values to represent their location within a plane called coordinates. Try to explain what you need using these definitions.
You need to login to post a reply.