Question: Java Programming Coding Assignment. JGrasp. This assignment focuses on exception processing using the try - catch - finally. You will modify the TryCatchExample program that

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 pasted below these instructions.
  2. You will modify the program to input an integer value and a double value. Each input should display a prompt indicating the type of data to be input.
  3. You will include try - catch clauses that will handle the following conditions: invalid integer values was input, an invalid double value was input, and a divide by zero operation.
  4. The code for exception processing should be: invalid integer input should result in an error message and a prompt for another integer, an invalid double value should result in an error message and a prompt for another double, and a divide by zero should result in an error message and the termination of the program.
  5. All input should be done from the keyboard using a Scanner object.

**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); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!