1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
liubo4ka [24]
3 years ago
5

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

op 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.
Computers and Technology
1 answer:
Leviafan [203]3 years ago
8 0

Answer:

using System;

namespace ConsoleApp3

{

   class Program

   {

       static void Main(string[] args)

       {

           double[] doubleArray = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };

           Console.WriteLine("Double Array values are:");

           foreach (var b in doubleArray)

           {

               Console.WriteLine(b);

           }

           Console.WriteLine("Enter value to find position in Array");

           var input = Console.ReadLine();

           var value = Convert.ToDouble(input);

           if (value == 99.0)

           {

               Environment.Exit(0);

           }

           try

           {

               var index = Array.IndexOf(doubleArray, value);

               if (index == -1)

               {

                   Console.WriteLine("Index was outside the bounds of the array");

                   Console.ReadLine();

               }

               else

               {

                   Console.WriteLine("Position in Array is:" + index);

                   Console.ReadLine();

               }

           }

           catch (Exception e)

           {

               Console.WriteLine("Index was outside the bounds of the array");

               Console.ReadLine();

           }

       }

   }

}

Explanation:

this is the code of console program which initialize the double array from 1-10 and displays the existing values of array in console.

Then it will take input from user, convert it to double and find the value position in double array.

if 99, then program will be exist

if exist in array:display the index position

else:index was outside the bounds of the array in try catch block.

You might be interested in
A bulb has a resistance of 15Ω and is rated at 3A. What is the maximum voltage that can be applied across the bulb?
Anastasy [175]

Answer:Wheres the option choice??????????????????????

Explanation:

7 0
2 years ago
Which feature is used to help identify the appropriate content for particular form fields?
Alika [10]

Answer:

The correct option is;

Content controls

Explanation:

Content controls are customizable controls that can be added to forms, templates and document that enable users to identify or preview the expected data that fills a given form field

Content controls can be in the form of instructional text that give users an idea of the expected format of the content of a given form field, such that the text disappears as soon as the user starts typing in their own text.

6 0
3 years ago
Which of the following are the lines defining the borders of a shape? (1 point)
shtirl [24]

Answer:

no I is edges

2 is gaming

3 is creativity

3 0
3 years ago
Gaven's instructor told him to include a personal statement in his work portfolio. Why did his instructor recommend including a
algol [13]
The recommendation of the instructor for Gaven to include a personal statement in his work portfolio will allow him to identify his career goals. If he is unable to show this to his work portfolio then he may simply state it in the personal statement. Thus, the answer to this item is letter A. 
3 0
3 years ago
Discuss the inte Generation of computer, Inlith
ch4aika [34]

Generations of Computers

The computers of today find their roots in the second half of the twentieth century. Later as time progressed, we saw many technological improvements in physics and electronics. This has eventually led to revolutionary developments in the hardware and software of computers. In other words, soon the computer started to evolve. Each such technological advancement marks a generation of computers.

3 0
3 years ago
Other questions:
  • ​some forms use a _____ that contains icons or buttons that represent shortcuts for executing common commands.
    14·1 answer
  • Search engines enable you to
    9·2 answers
  • What is a expansion card for computer?
    5·1 answer
  • How can rows be added to a table? Check all that apply.
    15·2 answers
  • Probability can be used to determine the likelihood of specific __________
    6·2 answers
  • Please hurry Arrange the steps of the engineering design process in the correct sequence.
    10·1 answer
  • Kris is the project manager for a large software company. Which part of project management describes the overall project in deta
    11·2 answers
  • 13. By adding built-in writable memory to its cartridge, Nintendo’s _________________ was the first console game that gamers cou
    9·1 answer
  • PLEASE HELPPPPP ASAP, 50 POINT'S + BRAINLIEST
    14·1 answer
  • What plugs into this?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!