import java.util.Scanner;
Illustrates the need for exceptions to handle input such as: 7, seven, and dividing by 0
public class DivideTwoNumbers{
public static int getInt(Scanner scanner, String prompt){
System.out.print(prompt);
return scanner.nextInt();
}
public static void main( String[] args ){
Scanner stdinScanner = new Scanner( System.in );
int num1 = 0;
int num2 = 0;
int result = 0;
num1 = getInt( stdinScanner, "Please enter a number: ");
num2 = getInt( stdinScanner, "Please enter another number: ");
result = num1 / num2;
System.out.println( num1 + " divided by " + num2 + " equals " + result);
}
}