Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

details about their usage. We also recommend you to refer to the .NEI' Framework reference documentation, which is rich of various examples. Finally, do not

image text in transcribed
image text in transcribed
details about their usage. We also recommend you to refer to the .NEI' Framework reference documentation, which is rich of various examples. Finally, do not forget to look at the references at the bottom of this task. The expected solution for this task must consist of two parts: a program code that creates a situation that generates each of the above exceptions and a text report that explains in your own words the facis you found. As the result of your study, your report must answer the following questions and discuss the related issues for each of the above exceptions. What is a possible situation that leads to the exception? Who is in charge of throwing the exception: you as a programmer or the runtime system? In theory, should you throw exceptions of this type? Explain your answer. If you need to throw the exception, what details would you provide as a message to the user {caller}? What parameters would you include in the message? Can the exception be generally caught {and therefore handled]? If the exception occurs, should you generally catch this excepiion type or is it better to pass such exception to the user [caller]? It is not enough to say yes or no; you must provide an argument to support your answer. Is the exception a case when you want to avoid this exception to occur in your application in general? If so, what would be your actions as a programmer to avoid it? Note that you must check whether all the above quesiions are actually relevant to a particular exception that you consider. Remember that some exceptions are reserved and are to be thrown only by line runtime system; in most cases they need to indicate a serious runtime problem. Other exceptions can be programmerdened and report about an incorrect input data or anticipated application failures. Thus, some exceptions you can avoid by doing a proper argument checking. So, to answer these questions correctly, you will have to focus on multiple implementation aspects and potential situations associated with each exception type. . The following is an illustrative example of how your solution may look like. Here, we discuss the Invalidperation Exceptiontype and give a sample code that throws it. This exception type is thrown when a method call is invalid for the object's current state. This, for example, can be caused by changing a collection {e.g., the content of an instance of re List Balance ) { throw new InvalidperationException("Insufficient fund"); } Balance = Balance - amount

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Statistics

Authors: Robert A Donnelly, Robert Donnelly Jr

2nd Edition

0133852288, 9780133852288

More Books

Students also viewed these General Management questions

Question

Describe five of G. Stanley Halls major achievements.

Answered: 1 week ago