If it is not explicitly told in following recipe, setting up services are described for Ubuntu 20.04 server, but applications are described for Xubuntu 20.04 workstation. If you use different Ubuntu version or Linux distribution, settings as well as content, names and places of configuration files may be different!
Got it.

7. Exceptions and assertions

Review the presentation Exceptions and safeguards

Tasks

  1. Explore the jtm.activity07 package
  2. Create the class SimpleCalcException as a subclass of Exception.
  3. Implement the following constructors for this class:
    1. SimpleCalcException(String string)
    2. SimpleCalcException(String string, Throwable cause)
  4. Implement basic arithmetic operations for the SimpleCalc class with int numbers in the range [-10..+10] (inclusive) to pass unit tests

error Notes

  1. The input range is checked using safeguards. Therefore, if they are disabled, any int value can be input
  2. The output is always checked and an exception is thrown if the value is outside the allowed range
  3. Only SimpleCalcExceptions can be thrown. AssertionErrors etc. must be caught and wrapped in SimpleCalcExceptions

Additional information


  

Created by Valdis Vītoliņš on 2025-01-28 17:34
Last modified by Valdis Vītoliņš on 2025-01-28 17:34
 
Xwiki Powered
Creative Commons Attribution 3.0 Unported License