Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 exceptionStep 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