Question: In C# Write the program SubscriptExceptionTest in which you use an array of 10 doubles. Write a try block in which you place a loop

In C# Write the program SubscriptExceptionTest in which you use an array of 10 doubles. Write a try block in which you place a loop that prompts the user for a subscript value and displays the value stored in the corresponding array position or asks the user to quit the program by entering 99. Create a catch block that catches any IndexOutOfRangeException and displays the message: Index was outside the bounds of the array. This is what I have so far.

In C# Write the program SubscriptExceptionTest in which you use an array

SubscriptExceptionTest.... Instructions Back 5 using System.Threading.Tasks; 6 using static System.Console 7 nanespace SubscriptExceptionTest1 Write the program SubscriptExceptionTest in which you use an array of 10 double s. Write a try block in which you place a loop that prompts the user for a subscript value and displays the value stored in the corresponding array position or asks the user to quit the program by entering 99. Create a catch block that catches any IndexoutofRangeException and displays the message: Test Results 2/3 passed Test Case 9 lass SubscriptExceptionTest 10 static void Main(string[] args) 12 13 14 15 16 17 18 19 29 21 22 23 24 double[] subscriptArray20.3, 44.6, 32.5, 46.7, 8 PASSED: Invalid array index test 1 67.5, 12.3, 14.6, 22.1, 13.63; Console.WriteLine( "Please enter a number" try{for (int = ; subscriptArray. Length; i++) Write("Enter subscript:") PASSED: Invalid array index test 2 int sub-Convert.ToInt32 (ReadLine)); WriteLine("SubscriptArray[(0)) = {1}",i,subscriptArrayli FAILED: Valid array index test utside the bounds of the array catch (Index0utOfRangeException) WriteLine(Index was outside the bounds of the array." Grading As you complete the steps above, you can use the Test button to Run Code Test Grade

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!