Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions