Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems For Advanced Applications Dasfaa 2023 International Workshops Bdms 2023 Bdqm 2023 Gdma 2023 Bundlers 2023 Tianjin China April 17 20 2023 Proceedings Lncs 13922

Authors: Amr El Abbadi ,Gillian Dobbie ,Zhiyong Feng ,Lu Chen ,Xiaohui Tao ,Yingxia Shao ,Hongzhi Yin

1st Edition

3031354141, 978-3031354144

More Books

Students also viewed these Databases questions

Question

access can display the results of a query in sorted order

Answered: 1 week ago