Question: Please Help JAVA 4. (This is a version of an exercise from Chapter 5.) Programming Project 5.2 from Chapter 5 asked you to create a

Please Help JAVA Please Help JAVA 4. (This is a version of an exercise from

4. (This is a version of an exercise from Chapter 5.) Programming Project 5.2 from Chapter 5 asked you to create a class named Fraction. This class is used to represent a ratio of two integers. It should include mutator functions that allow the user to set the numerator and the denominator along with a method that displays the fraction on the screen as a ratio (e.g., 5/9). Modify the class so that it throws the exception Denominator IszeroException if the denominator is set to zero. Do not forget to account for the constructors! You will have to create the DenominatorIszeroException class and it should be derived from Exception. Write a main method that tests the new Fraction class, attempts to set the denominator to zero, and catches the Denominator IszeroException exception

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!