In the DoOp() method for class Divider, use the try-catch mechanism to prevent division by zero.

In C++, create an Exception class, and a DivideByZero sub-class that takes a string for its constructor, and use this in the try-catch mechanism. In Java, use the division by zero exception object.

Catch these exceptions in the Test() function/method to output the error message.

Run both C++ and Java versions of your program and include the outputs in your submission.

 

Program must contain the following :  use cerr for error msg and write try and catch in test function....these r 2 requirements he want us to do if u check DoOp code there is test function in bottom. 

    • 12 years ago
    C++ and Java Doop Program
    NOT RATED

    Purchase the answer to view it

    • divider.cpp
    • screenshot.png
    • dividebyzeroexceptionsdemo.java