This is my assignment from teacher:

Copy and paste a SIMPLE method (that does not take input) from one of your other programs. The entire method should be pasted after the paint method, and called BY the paint method, passing the appropriate parameters. If the method displays output, you will need to pass the graphics object. Do not chooose a method that has multiple lines of output unless you really want a challenge.

Is this a finished product? It says to call the method to the paint method, which I have done, is this a finished product?

So this is my code:

import java.applet.Applet; // Imports the Applet class import java.awt.Graphics; // Imports the Graphics class, used to draw lines, circles, squares, text, etc /** * The HelloWorld class implements an applet that simply displays "Hello World!". */ // Our HelloWorld class extends the Applet class, giving it access to all the methods of Applet. public class HelloWorld extends Applet { // The paint method draws anything that is in our applet on the applet screen. // It takes a graphics object (g), that is used to draw public void paint(Graphics g, double distance) { double x1; double x2; double y1; double y2; x1 = 1; x2 = 1; y1 = 1; y2= 1; g.drawString("Logan Carl Crone", 50, 25); g.drawString("Can You Find Me??", 250,150); distance (x1, y1, x2, y2); } public static double distance (double x1, double y1, double x2, double y2) { double dx = x2 - x1; double dy = y2 - y1; double dsquared = dx*dx + dy*dy; double distance = Math.sqrt (dsquared); return distance; } }