I can't find this typing error. Somewhere on Line 44.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Weight extends JFrame
implements ActionListener {
private JButton button;
public static void main(String[] args) {
Weight frame = new Weight();
frame.setSize(400, 300);
frame.createGUI();
frame.setVisible(true);
}
private void createGUI() {
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container window = getContentPane();
window.setLayout(new FlowLayout() );
button = new JButton("Calculate Weight Loss");
window.add(button);
button.addActionListener(this);
}
public void actionPerformed(ActionEvent event) {
int bikeHours, joggingHours, swimmingHours, weightLoss;
int bikeCalFinal, jogCalFinal, swimCalFinal;
int bikeCal = 200, jogCal = 475, swimCal = 275;
String bikeString;
String joggingString;
String swimmingString;
bikeString = JOptionPane.showInputDialog("Hours cycling: ");
bikeHours = Integer.parseInt(bikeString);
bikeCalFinal = bikeHours * bikeCal;
joggingString = JOptionPane.showInputDialog("Hours jogging: ");
joggingHours = Integer.parseInt(joggingString);
jogCalFinal = joggingHours * jogCal;
swimmingString = JOptionPane.showInputDialog("Hours swimming: "); // This is where I get the error. The line above. Line 44
swimmingHours = Integer.parseInt(swimmingHours);
swimCalFinal = swimmingHours * swimCal;
weightLoss = (bikeCalFinal + jogCalFinal + swimCalFinal) / 3500;
JOptionPane.showMessageDialog(null, weightLoss + "pounds were lost");
}
}