Something went wrong. Try again.
Codelabs for major subjects in the BSIT course at STI College Meycauayan. gitlab.com/andreijiroh-dev/labs/studentops-codelab
codelabs labs
Something went wrong. Try again.
912 B · 25 lines
Java
at commit 26c91cc6
1234567891011121314151617181920212223242526package dev.andreijiroh.studentops.projects;
/** * Computer Programming 2 - 04 Laboratory Exercise * v1 - as seen on the whiteboard * @author Andrei Jiroh Halili (STI College Meycauayan) <halili.459491@meycauayan.sti.edu.ph> */public class DivideDemo { public static void main(String[] args) { try { int a = 10; int b = Integer.parseInt(args[0]); int result = a / b; System.out.println("Result: " + result); } catch (ArrayIndexOutOfBoundsException e) { System.err.println("Provide one integer to continue."); } catch (ArithmeticException e) { System.err.print("Can't divide by zero or something gone wrong while trying to divide"); } catch (NumberFormatException e) { System.err.println("That parameter must be a integer"); } catch (Exception e) { System.err.println("Something gone wrong while running this program: "+ e); } }}