2/05/2009

seconds2minutes V. 2

Today i read about short hand opperators and how to get user input. I updated my seconds2minutes calculationprogram. I modified the assignment of the variable to:

int seconds = Integer.parseInt(JOptionPane.showInputDialog(null, "How many seconds?"));


Here is the executable

2/03/2009

Calculate Circle Area

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.