8.1 In the previous chapter exercises the Car and GreenCar classes were updated so that when logical conditions were violated, exceptions were thrown. Add new ApplicationException-derived classes that will be thrown instead.

8.2 How does the use of user-defined exceptions change the Try-Catch blocks on the client-side code? Can you code the UDE and throw them so that the client code does not need to add more Catch statements?

8.3 To improve the performance of the client code, there may be cases where If statements may replace Try-Catch blocks, can you locate at least one such case, and why checks are better than Catches?

8.4 How would you reduce Try-Catch blocks and use more centralized EH code?

8.5 What would be a good situation be where the Car and GreenCar classes would return values indicating errors vs. throwing exceptions?

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.