The while loop reads values from input until an integer is read. Complete the exception handler in the while loop to catch an InputMismatchException exception and: Output "Removed unacceptable input for number of cents". End with a newline. Discard the invalid input. Ex: If the input is 20 60, then the output is: 20 cents = 4 nickels Processed one valid input value Ex: If the input is Aya Tia 20 60, then the output is: New JAVA code can only be added after code given:     Removed unacceptable input for number of cents Removed unacceptable input for number of cents 20 cents = 4 nickels Processed one valid input value Note: Each value read from input is on one line.       /*******************************************************************************************************                                New Java Code here: test input:   Aya Tia 20 60 **************************************************************************

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter12: Exception Handling
Section: Chapter Questions
Problem 5PE
icon
Related questions
Question

The while loop reads values from input until an integer is read. Complete the exception handler in the while loop to catch an InputMismatchException exception and:

  • Output "Removed unacceptable input for number of cents". End with a newline.
  • Discard the invalid input.

Ex: If the input is 20 60, then the output is:

20 cents = 4 nickels Processed one valid input value

Ex: If the input is Aya Tia 20 60, then the output is:

New JAVA code can only be added after code given:

 

 

Removed unacceptable input for number of cents Removed unacceptable input for number of cents 20 cents = 4 nickels Processed one valid input value

Note: Each value read from input is on one line.

 

 

 

/*******************************************************************************************************                                New Java Code here: test input:   Aya Tia 20 60

*******************************************************************************************************/

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Exception Handling Keywords
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT