package Lect25Callstack;

import javax.swing.*;

public class ExceptionsExTwo {
	public void TestOne() {		
		int x = Integer.parseInt(JOptionPane.showInputDialog(null, "Input first value"));
		int y = Integer.parseInt(JOptionPane.showInputDialog(null, "Input second value"));    
		
		try {
			System.out.println("Div: "  + (x/y));
			System.out.println("Division completed");
		} catch(ArithmeticException exception) {
			System.out.println("Division by zero attempted");
			
//			System.out.println("Try again Div: "  + (x/y));			
		}
		
		System.out.println("Prod: " + (x*y));
		System.out.println("Sum:" + (x+y));   
	}
	
	public static void main(String[] args) {
		ExceptionsExTwo ex = new ExceptionsExTwo();
		
		ex.TestOne();
	}
}
