All pastes #543415 Raw Edit

Someone

public text v1 · immutable
·published 2007-06-06 02:24 UTC
rendered paste body
import java.io.DataInputStream;
import java.io.*;

public class Javnan {
	public static float quotient( int numerator, int denominator ) throws ArithmeticException {
   		return (float)numerator / (float)denominator; // possible division by zero
	}


	public static void main(String[] args) throws IOException {	
		
    	int x = 0; int y = 0; float result = 0; String input = new String();
		boolean valid = false;
		DataInputStream in = new DataInputStream(System.in);

		while ( ! valid ) {
			try {
				System.out.print( "Dwse akeraio GAY: " );
				input = in.readLine();
				x = Integer.parseInt( input );
				valid = true;
			} catch ( NumberFormatException e ) {
				System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." );
			}
		}
		
		valid = false;
		
		while ( ! valid ) {
			try {
				System.out.print( "Dwse allon enan: " );
				input = in.readLine();
				y = Integer.parseInt( input );
				valid = true;
			} catch ( NumberFormatException e ) {
				System.out.println( e.getMessage() + " mpravo malaka, aftos den einai akeraios." );
			}
		}
		
		try {
			result = quotient(x, y);
			System.out.println("apotelesma: " + result);
		} catch ( ArithmeticException arithmeticException ) {
			System.out.println( arithmeticException.getMessage() + " o diairetis einai 0, ZWO." );
		}
	}
}