so I'm writing a program that gives the number of minutes for every input of x seconds... now the issue is that once I type in the first value, it asks for another value and divides that....and another value...and another...and so on... how can I get it to only give me one value and finish with that one value instead of a never-ending thing?
import javax.swing.JOptionPane;
class TimeCalculator {
public static void main(String[] args) {
double seconds;
String input;
input = JOptionPane.showInputDialog("Enter any number of seconds");
seconds = Double.parseDouble(input);
if (seconds >= 60);
JOptionPane.showInputDialog(null, "There are " + (seconds/60) + " minutes in " + seconds + " seconds.");
if (seconds >= 3600);
JOptionPane.showInputDialog(null, "There are " + (seconds/60) + " minutes in " + seconds + " seconds.");
if (seconds >= 60);
JOptionPane.showInputDialog(null, "There are " + (seconds/86400) + " minutes in " + seconds + " seconds.");
System.exit(0);
}
}
Aucun commentaire:
Enregistrer un commentaire