Lab 7.2.1 Exceptions: simple checks Objectives Familiarize the student with: • situations when exceptions are thrown; • throwing exceptions; handling exceptions. Scenario Write a very simple class to...


pls help asnwer this code in c++


Lab 7.2.1 Exceptions: simple checks<br>Objectives<br>Familiarize the student with:<br>• situations when exceptions are thrown;<br>• throwing exceptions;<br>handling exceptions.<br>Scenario<br>Write a very simple class to hold one value and its boundaries (limits of the value in integer numbers), add one method to add a value to<br>the one held in the instance of class, and one method to subtract a value from the one held in the object. In both methods, throw an<br>exception when a value exceeds the limits. In the main function create two objects and test them with different scenarios. Print the<br>values held at the end of the program. Add adequate try-catch blocks and an appropriate message.<br>Example input<br>5 0 10<br>9 0 100<br>15<br>15<br>90<br>Example output<br>Value could exceed limit.<br>Value could exceed limit.<br>24<br>

Extracted text: Lab 7.2.1 Exceptions: simple checks Objectives Familiarize the student with: • situations when exceptions are thrown; • throwing exceptions; handling exceptions. Scenario Write a very simple class to hold one value and its boundaries (limits of the value in integer numbers), add one method to add a value to the one held in the instance of class, and one method to subtract a value from the one held in the object. In both methods, throw an exception when a value exceeds the limits. In the main function create two objects and test them with different scenarios. Print the values held at the end of the program. Add adequate try-catch blocks and an appropriate message. Example input 5 0 10 9 0 100 15 15 90 Example output Value could exceed limit. Value could exceed limit. 24

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here