All pastes #946180 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-03-17 14:53 UTC
rendered paste body
import javax.swing.JOptionPane;
public class EvenOdd {
	
	public static void main(String[] args) {
		String numStr, result;
		int num, again;
		
		do
		{
			numStr=JOptionPane.showInputDialog ("Enter an integer: ");
			
			num = Integer.parseInt(numStr);
			
			result="That number is " + ((num%2==0)?"even" : "odd");
			
			JOptionPane.showMessageDialog (null, result);
			
			again = JOptionPane.showConfirmDialog ( null, "do Another?");
		}
		while (again==JOptionPane.YES_OPTION);
	}	
}