subject

Write a program that reads integers userNum and divNum as input, and output the quotient (userNum divided by divNum). Use a try block to perform the statements. Use a catch block to catch any ArithmeticException and output an exception message with the getMessage() method. Use another catch block to catch any InputMismatchException and output an exception message with the toString() method. Note: ArithmeticException is thrown when a division by zero happens. InputMismatchException is thrown when a user enters a value of different data type than what is defined in the program. Do not include code to throw any exception in the program.
Ex: If the input of the program is:
15 3
the output of the program is:
5
Ex: If the input of the program is:
10 0
the output of the program is:
Arithmetic Exception: / by zero
Ex: If the input of the program is:
15.5 5
the output of the program is:
Input Mismatch Exception: java. util. InputMismatchException

ansver
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 15:30, mikey3882
When creating a budget, log fixed expenses before income. after income. after savings. at the top.
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
image
Computers and Technology, 23.06.2019 13:30, small77
Font size, font style, and are all aspects of character formatting.
Answers: 2
image
Computers and Technology, 23.06.2019 16:30, saintsfan2004
How to do this programming flowchart?
Answers: 3
You know the right answer?
Write a program that reads integers userNum and divNum as input, and output the quotient (userNum di...

Questions in other subjects:

Konu
Mathematics, 06.04.2021 17:20
Konu
Mathematics, 06.04.2021 17:20
Konu
Social Studies, 06.04.2021 17:20