Since last time i blogged i learned about identifiers, variables, assignment statements and assignment expressions, constants and numeric data types and operations. Today i created a simple little program to calculate how minutes out of seconds. It's a really basic program and it also doesn't work with user input (YET!).
Here is the code:
import javax.swing.JOptionPane;
public class seconds2minutes {
public static void main(String[] args) {
int seconds = 500;
int minutes = seconds/60;
int remainingSeconds = seconds % 60;
JOptionPane.showMessageDialog(null, seconds + " seconds is " + minutes+ " minutes and " + remainingSeconds + " seconds");
}
}
I also uploaded an executable jar (which i finally figured out how to create in jBuilder!) Here is the link.
2/03/2009
Subscribe to:
Post Comments (Atom)
I was able to upload the file and it runs. It took me 500 seconds to do this.. not really.
ReplyDeleteGood job on getting an executable file out there.
Keep the Blog going - it is important to keep the information flowing about what you are doing and what you have learned.
Thanks Florian,
~Richard.