Examlex

Solved

Import Java.util.*; Public Class DivisionMistakeCaught3

question 64

Essay

import java.util.*;
public class DivisionMistakeCaught3
{
    public static void main(String[] args)
    {
       Scanner input = new Scanner(System.in);
       int numerator, denominator, result;
       try
       {
          System.out.print("Enter numerator >> ");
          numerator = input.nextInt();
          System.out.print("Enter denominator >> ");
          denominator = input.nextInt();
          result = numerator / denominator;
          System.out.println(numerator + " / " + denominator + " = " + result);
       }
       catch(ArithmeticException mistake)
       {
          System.out.println(mistake.getMessage());
       }
       catch(InputMismatchException mistake)
       {
          System.out.println("Wrong data type");
       }  
    }
}
Using the above code, describe what will happen if a user enters two usable integers. What will happen if a user enters an invalid noninteger value? What will happen if the user enters 0 for the denominator?


Definitions:

Sexual Harassment

Unwelcome sexual advances, requests for sexual favors, and other verbal or physical harassment of a sexual nature in the workplace or academic settings.

Sexual Harassment Training

Educational programs intended to inform employees about what constitutes sexual harassment, how to prevent it, and how to report it if it occurs.

Racial Harassment

Unwanted conduct related to a person's race or ethnicity that creates an intimidating, hostile, degrading, humiliating, or offensive environment for the victim.

Total Quality Management (TQM)

A management approach focused on embedding awareness of quality in all organizational processes, aiming for long-term success through customer satisfaction.

Related Questions