Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions

Question

What were the issues and solutions proposed by each team?

Answered: 1 week ago

Question

3. Who would the members be?

Answered: 1 week ago