How should you handle the exceptional situation

Assignment Help Basic Computer Science
Reference no: EM131782668

Question: Suppose you are implementing a method to compute a formula that involves dividing a quantity by a variable x. You realize that if x is 0, then an Arithmetic Exception will be thrown. How should you handle this exceptional situation? Here are some alternatives:

a. Ignore the problem and let your method throw an Arithmetic Exception.

b. Test for x 0 before doing the computation and, if found, print an error message and return 0.

c. Surround the computation with a try/catch block and print an error message in the catch block before returning 0. Compare these alternatives. Is there a fourth alternative that is better than these three?

Reference no: EM131782668

Questions Cloud

Prepare a production budget for september and october : Prepare a production budget for September, October, ani likes to have 5% of the next month's sales needs on hand at the end of each month
Determine the free cash flow for mediterranean tile company : Mediterranean Tile Company has cash flows from operating activities of $120,000. Determine the free cash flow for Mediterranean Tile Company
Paper on HR policy and implementation in public sector : Prepare a Research paper on HR Policy and Implementation in Public Sector - Explain in general what do you mean by research philosophy
Problems and write complete answers : Show all work as you solve the following problems and write complete answers, including appropriate units. 24.) Alberto left school and drive toward he lake.
How should you handle the exceptional situation : Suppose you are implementing a method to compute a formula that involves dividing a quantity by a variable x.
Simplify the radical expressions : Simplify the radical expressions. 21.) v384m^3p^4q^4 22.) (1+ v2)(-5-2 v2) Solve the equation and show the check if the potential answer(s).
Discuss accounts receivable and cash budget : Schedule of Cash Collections on Accounts Receivable and Cash Budget
What was the fixed overhead spending variance : Each unit requires 20 minutes of direct labor. If 13,200 units were produced, what was the fixed overhead spending variance
Perform the indicated operation and simplify : Perform the indicated operation and simplify. 14.) (3x^4-3x+3x^3)-(7x^3-5x^4+7) Multiply as indicated and simplify. 15.) (b+7)(7b^2-3b-2)

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd