7.1 In the previously designed Car and GreenCar classes, there were situations where the code checks for logical errors. For example, Gas level must be positive, Vin Number must be alphanumeric only, or Miles driven must be positive.

  • Add code to check for these logical errors, so that when an error occurs, the class code would issue an errormessage via Messagebox.
  • Now to contrast that with EH and replace every Messagebox showing an error from Car or GreenCar with a Throw New Exception statement. Generate an error message in the Throw statement that describes the error.
  • Step 2 above, will require that the client code hendle these exceptions using Try-Catch statement. Add Try-Catch statement where the code is expected to cause exception in the client code.
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.