Menu

Java Programming Coding Assignment Jgrasp Assignment Focuses Exception Processing Using Tr Q43881549

Java Programming Coding Assignment. JGrasp.

This assignment focuses on exception processing using the try -catch – finally.

  1. You will modify the TryCatchExample program that is pastedbelow these instructions.
  2. You will modify the program to input an integer value and adouble value. Each input should display a prompt indicating thetype of data to be input.
  3. You will include try – catch clauses that will handle thefollowing conditions: invalid integer values was input, aninvalid double value was input, and a divide by zerooperation.
  4. The code for exception processing should be: invalid integerinput should result in an error message and a prompt for anotherinteger, an invalid double value should result in an error messageand a prompt for another double, and a divide by zero should resultin an error message and the termination of the program.
  5. All input should be done from the keyboard using a Scannerobject.

**Code**

//***************************************************
//
// Example file for Exception Processing Assignment
//
// Author: Kim Cannon
// Date: 5/14/15
//
//***************************************************

import java.util.Scanner;

public class TryCatchExample {

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

System.out.print(“Input integer value: “);
int in = input.nextInt();
  
System.out.println(“Value input was: ” + in);
}
}

Expert Answer


Answer to Java Programming Coding Assignment. JGrasp. This assignment focuses on exception processing using the try – catch – fina…

OR