You're welcome! Also note that there are other ways to change a number into a String, one being String.valueOf(dbl).
Type: Posts; User: curmudgeon
You're welcome! Also note that there are other ways to change a number into a String, one being String.valueOf(dbl).
Ah, you need to translate it into a String. One "cheat" is to create a String on the spot by concatenating the numeric value with the empty String literal, "". i.e.,
g. drawString("" + dbl,...
You get the double returned and put it into a double variable same as you normally would.
double dbl = distance(x1, y1, x2, y2);
Then use the dbl variable in drawString.
Does it compile? Does it run? Does it do what you want it to do?
One hint: your instructor told you to have the paint method call the other method -- you'll want to do something with the double...