sumInfinite() method... HELP!
This is what I have so far, I have no idea that it is right, except for the stuff before the sumFinite() method. Does anyone know how to do the code for the sumInfinite() method? Please help!
import javax.swing.*;
import java.awt.*;
public class Display08 extends JPanel
{
private JLabel label;
private JTextField box1, box2, box3;
public Display08()
{
setLayout(new GridLayout(4, 2));
add(new JLabel("Terms:", SwingConstants.RIGHT));
box1 = new JTextField("", 5);
box1.setHorizontalAlignment(SwingConstants.LEFT);
add(box1);
add(new JLabel("First:", SwingConstants.RIGHT));
box2 = new JTextField("", 5);
box2.setHorizontalAlignment(SwingConstants.LEFT);
add(box2);
add(new JLabel("Ratio:", SwingConstants.RIGHT));
box3 = new JTextField("", 5);
box3.setHorizontalAlignment(SwingConstants.LEFT);
add(box3);
add(new JLabel("Sum:", SwingConstants.RIGHT));
label = new JLabel("");
label.setFont(new Font("Serif", Font.BOLD, 20));
label.setForeground(Color.blue);
add(label);
}
public void sumFinite()
{
double y = Double.parseDouble(box3.getText());
x = Double.parseDouble(box2.getText());
total = x;
for(int alpha = Integer.parseInt(box1.getText());alpha > 0; alpha--)
{
x = x * y;
total = total + x;
}
label.setText("Sum: " + total);
}
}
public void sumInfinite()
{
}
}

