Question: Create a program that computes the integer division of two integers. It should prompt the user for two integer values, one for the numerator and

Create a program that computes the integer division of two integers. It should prompt the user for two integer values, one for the numerator and one for the denominator. Define an exception class DivByZero that has a function calledQuotient. The function should take two integer values as input and return an integer value. For example, if the inputs are 5 and 3, it would return 1. However, if the second integer value (or the denominator) is 0, then it should throw adivide-by-zero exception which is caught by the main program. The main program should print a custom error message when this happens that says that there was an attempt to divide by zero and then it should exit normally.

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!