Question: Introduction to JAVA Project: I need help with my homework this week. Given a program (Test.java) that gets two numbers from user input and then

Introduction to JAVA Project: I need help with my homework this week.

Introduction to JAVA Project: I need help with my homework this week.

Given a program (Test.java) that gets two numbers from user input and

then carries out a division, revise it to handle exceptional inputs. The

Given a program (Test.java) that gets two numbers from user input and then carries out a division, revise it to handle exceptional inputs. The given program does those: Prompt 1 Input 1 Prompt 2 Input 2 Calculation For the purpose of this project, input 1 should be a double value and input 2 should be a non-zero int value. Upon an invalid input, your program should allow a user to re-enter a piece of data. This would require a loop to validate each input and allow for additional data entry. We need a loop instead of an if-else as you can't assume a second input would be valid. You will complete this exercise using two approaches: 1. use try-catch. 2. Use defensive coding. Save each version in a different source code file. Version A: Try-Catch Because invalid data must be removed from an input stream object before additional input could happen, you need to read in each number as a string and then parse the data in the string. Follow this pseudo code for the try-catch version: Do // loop if wrong type of input isvalid

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!