This is my code so far......
import java.applet.Applet;
import java.awt.*;
import javax.swing.JOptionPane;
public class HelloWorld extends Applet {
Font myFont = new Font ("Times Roman", Font.BOLD, 25);
public void paint (Graphics g) {
g.setFont (myFont);
g.setColor (Color.BLUE);
g.drawString ("My Name" , 20, 30);
String first;
first = JOptionPane.showInputDialog (null, "Enter first number: ");
double f = Double.parseDouble (first);
String second;
second = JOptionPane.showInputDialog (null, "Enter second number: ");
double s = Double.parseDouble (second);
String third;
third = JOptionPane.showInputDialog(null, "Enter third number: ");
double t = Double.parseDouble (third);
double avg = (f + s + t) / 3;
JOptionPane.showMessageDialog (null, "Average = " + avg);
}
}
How do I print the average that I will get after entering three numbers in the applet?