Question
Assume we have a method that check a student GPA and if GPA is below 2.0 it will throw an exception that will be handled
Assume we have a method that check a student GPA and if GPA is below 2.0 it will throw an exception that will be handled by a custom exception handler. Your job is to write a custom exception that handles the case when a student GPA is less than 2.0 which indicates that he cannot graduate from the collage.
Write custom exception handler class
Complete method checkGPA. Exception message should be student cannot graduate
Write the main class. Instantiate two objects to test your code. One to test gpa<2.0 and another one to test gpa >= 2.0
Submit your code and output.
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