Creating and catching Exceptions in C# (files attached)

Modify the car object to throw 3 new exceptions

[1] Modify the StartEnginemethod:

Change the logic to support If they do a start when the engine is already started:

You throw new ApplicationException(someAppropriateErrorMsg)

[2] Modify the StopEngine method:

Change the logic to support If they do a stop engine when the speed is not zero:

You throw new ApplicationException(someAppropriateErrorMsg)

[3] Change the accelerate method such that if they call it when the engine is not running:

You throw new ApplicationException(someAppropriateErrorMsg) (And do not to change the speed) (Braking works if the engine is on or off, so no change needed)

[4] If you run your program now, and do 3 nonsensical things (trying to accelerate when the engine is not running, trying to start the engine when it is already started, and trying to stop the engine when it is already stopped, the system should pop up “uncaught exception” boxes. When you have all 3 “throws”working, then move to modify the console program, program.cs:

So now modify the 3 appropriate cases of your switch statements by adding a Try Catch to each one of them. Now when you do the 3 nonsense things, you should catch the errors and take the returned errormessage (from your throw code over in the car class) and write them into the ErrorMessage variable.

[5] Modify other “correct” paths (when no problem is encountered) to overwrite any previous value in the ErrorMessage variable with the message “All is well” such that the errors go away after the usermoves on and does something that is not an error. In other words, the status message should always be showing current correct status.

Do not add Console.WriteLines statements other places then where they already are.