/*
* @(#)DivideByZero.java 1.0 02/02/02
*
* You can modify the template of this file in the
* directory ..\JCreator\Templates\Template_1\Project_Name.java
*
* You can also create your own project template by making a new
* folder in the directory ..\JCreator\Template\. Use the other
* templates as examples.
*
*/
package myprojects.dividebyzero;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class DivideByZero extends JFrame {
public DivideByZero() {
System.out.println("example of divide by zero"+divide("42","10"));
}
public static void main(String args[]) {
DivideByZero d = new DivideByZero();
}
public double divide( String numberHours , String rate ) {
double temp=0.0d;
try {
int num = Integer.parseInt(numberHours);
int den = Integer.parseInt(rate);
temp = num/den;
System.out.println("temp"+temp);
}
catch (Exception e){
System.out.println("Generic exception catch"+e);
}
return temp;
}
}
|