Class ExceptionsHandledWithExit

java.lang.Object
  extended by ExceptionsHandledWithExit

public class ExceptionsHandledWithExit
extends java.lang.Object

Validating that both inputs are integers and the denominator is not zero an using methods and system exits.

Version:
Copyright (c) 2002 -- SCCC West
Author:
Prof. Carl B. Struck

Constructor Summary
ExceptionsHandledWithExit()
           
 
Method Summary
static int inputInt(java.lang.String prompt)
          Displays a message to the user, gets input from the terminal and evaluates that it is an 'int'.
static boolean isInteger(java.lang.String numberString)
          A boolean method that evaluates a 'String' to see if all characters within it are integers.
static void main(java.lang.String[] args)
          Input two 'int' variables, calculate and display the quotient of the division operation.
static int quotient(int numerator, int denominator)
          Performs division with the numerator and denominator parameters and returns the quotient.
 
Methods inherited from class
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionsHandledWithExit

public ExceptionsHandledWithExit()
Method Detail

inputInt

public static int inputInt(java.lang.String prompt)
Displays a message to the user, gets input from the terminal and evaluates that it is an 'int'. Application exits if user input is not an 'int'.

Parameters:
prompt - The message displayed to the user
Returns:
The 'int' entered from the terminal by the user

isInteger

public static boolean isInteger(java.lang.String numberString)
A boolean method that evaluates a 'String' to see if all characters within it are integers.

Parameters:
numberString - The 'String' to be evaluated

main

public static void main(java.lang.String[] args)
Input two 'int' variables, calculate and display the quotient of the division operation.

Parameters:
args - The String[] array command line parameter

quotient

public static int quotient(int numerator,
                           int denominator)
Performs division with the numerator and denominator parameters and returns the quotient. Application exits if the denominator is zero (0).

Parameters:
numerator - The dividend of the division operation
denominator - The divisor of the division operation
Returns:
The result of the division operation