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
The _____ provides a basis for creating the project schedule and performing earned value management for measuring and forecastin
inna [77]

Answer:

WBS

Explanation:

<h2><u>Fill in the blanks</u></h2>

The <u>WBS</u> provides a basis for creating the project schedule and performing earned value management for measuring and forecasting project performance.

6 0
3 years ago
What happens when your project is rendered?
jok3333 [9.3K]

Answer:

B

Explanation:

when your rendering video project your computer is processing all the data that goes into creating images you experience video rendering every time you look at your computer the images on your screen has all been rendered to produce the website photo or video you are looking at

4 0
3 years ago
Program ___________________ are written explanations that are not part of the program logic but that serve as documentation for
Aleks04 [339]

Answer:

Program Comments

Explanation:

program comments are explanations. They are not executable code and the can actually appear anywhere in your code. Their main function is code documentation for the future. In Java programming language for example three types of comments is used. These are

// Single line comments  (This starts with two forward slashes

/* Multiple Line

comment

Style*/    

The third is the javadoc that gives a description of a function. I looks like the multiple line but is has two asterics

/** This is javadoc

comment

style*/

8 0
3 years ago
Investigators are combing the site of an explosion with mesh screens to collect evidence. The explosion was very large, leaving
rewona [7]

Answer: SCANNING ELECTRON MICROSCOPY,

Explanation:Many methods are available for use in an explosion site to determine or confirm the explosive materials or bomb fragment seen or obtained from the site they include the following; SCANNING ELECTRON MICROSCOPY,

CHROMATOGRAPHY-MASS SPECTROMETRY, STEREO MICROSCOPY, CAPILLARY ELECTROPHORESIS.

SCANNING ELECTRON MICROSCOPY, is a technique used to identify or confirm a material by scanning the surface of the material using FOCUSED BEAM OF ELECTRONS IN AN ELECTRON MICROSCOPE.

6 0
3 years ago
Read 2 more answers
Specialized programs that allow particular input or output devices to communicate with the rest of the computer system are calle
In-s [12.5K]
Hi!

These programs which allow a peripheral device to interact with the rest of the computer system are going to be <em>device drivers.</em>

Hopefully, this helps! =)
3 0
3 years ago
Other questions:
  • Chat messages are most likely to be found where on a computer? firewall nic internet history ram
    7·1 answer
  • The right of workers to seek safety and health on the job without fear of punishment is spelled out in:
    8·1 answer
  • "The ability to create methods with the same name that are in different classes" is known as ________.
    14·1 answer
  • Gloria is in her sophomore year of college and works part time. She has assignments saved on her home computer, her aunt's lapto
    6·2 answers
  • The scheme function (mult2-diff Ist) should take one argument, a list of numbers, and results in multiplying each number in the
    11·1 answer
  • What happens when two computers have the same IP address?
    13·1 answer
  • Which of the items below are nodes? fax, IC, NOC, printer, twisted pair cables and workstation.
    13·1 answer
  • There are two String variables, s1 and s2, that have already been declared and initialized. Write some code that exchanges their
    14·2 answers
  • Inputting a range of numbers comprising a batch and then inputting each serially numbered document is characteristic of the cont
    11·1 answer
  • Set of general format used to write program in any programming language?​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!