This project is all about intentionally breaking things — and catching them gracefully. You'll simulate multiple error scenarios and handle each one specifically.
YOUR TASK
Create a program that deliberately triggers and handles these 3 exceptions:
DivideByZeroException — divide any number by zero
FormatException — try to parse a non-numeric string as an int
IndexOutOfRangeException — access an array index that doesn't exist
Each catch block must print a specific message identifying what went wrong.
Need a hint?
Pattern:
1. Use 3 separate try/catch blocks, one per test
2. DivideByZero: int x = 5 / 0;
3. FormatException: int.Parse("hello");
4. IndexOutOfRange: int[] arr = {1}; int v = arr[5];
5. Each catch should print something like "Caught: divide by zero"
Expected output:
Caught: Attempted to divide by zero.
Caught: Input string was not in a correct format.
Caught: Index was outside the bounds of the array.
Code Editor
Ready
Output
Console
Console initialized...
Ready for Project 5: Exception Tester Tool
> Test your code with the "Check My Code" button
> When it passes, the Complete button will activate!