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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started