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
In this project, you will add a (self-proclaimed) priority attribute to xv6 processes. The priority does not actually do anythin
kondor19780726 [428]

Answer:

Priority programming is a process programming method based on priority. In this technique, the developer chooses the tasks to work according to priority, which is different from other types of programming, for example, a simple round-robin.

On UNIX and many other systems, higher priority values represent lower priority processes. Some of the systems, such as Windows, use the opposite convention: a higher number means a higher priority

<h3>Explanation: </h3>

Priorities can be dynamic or static. Static priorities are assigned during creation, while dynamic priorities are assigned according to the behavior of the processes while they are in the system. To illustrate, the planner could favor intensive input / output (I / O) tasks, allowing expensive requests to be issued as soon as possible.

Priorities can be defined internally or externally. Internally defined priorities make use of a measurable amount to calculate the priority of a given process. On the contrary, external priorities are defined using criteria beyond the operating system (OS), which may include the importance of the process, the type and sum of the resources used for the use of the computer, user preferences , trade and other factors such as politics etc.

i hope this is right lol

6 0
3 years ago
While investigating the settings on your SOHO router, you find two IP addresses reported on the device’s routing table, which is
Semenov [28]

Answer:

Explanation:

Always the getaway is the first device in a network, and for that was assigned this IP address 192.168.2.1, is the first address of the block, a network getaway gives us interoperability between networks and contains devices, and is a protocol translator, this is a piece of hardware used for telecommunication networks.

8 0
3 years ago
Td udutdiydiyfyfigciydutdutdtt
luda_lava [24]

hghsFHSkuhsdggewyewGUKweutgqeYFGYhgsukGFwufYHFUKyfukyfeukfrgkufwrGwukfrgtuskgtweYRtueoytewiuWYI7W

5 0
2 years ago
Read 2 more answers
Name two purposes of creating a microsoft account for use in visual studio 2015
Kazeer [188]
Creating a Microsoft account for use in Visual Studio 2015 means that you will get a better and optimized user experience, with several benefits.
Some of the purposes why you should create an account are:
1. free software, training and support from Visual Studio and broad range of benefits
2. synchronized Visual Studio Settings, which means that you will have for example the same layout, window and color theme, or whatever you select in the settings, every time you log in with your account


4 0
3 years ago
Create a bulleted list of four descriptive terms describing possible values a person may have. These may be your own values, or
Minchanka [31]
Create a bulleted list of four descriptive terms describing possible values a person may have.

* always be true to yourself
* honesty is the best policy
* making mistakes leads you to solutions
* it's ok to be wrong
7 0
3 years ago
Other questions:
  • Bob received a message from Alice which she signed using a digital signature. Which key does Bob use to verify the signature?Gro
    13·1 answer
  • A retail company assigns a $5000 store bonus if monthly sales are $100,000 or more. Additionally, if their sales exceed 125% or
    5·1 answer
  • Suppose your friend, who is a small business owner, wants to computerize her business functions such as accounting, payroll, and
    7·1 answer
  • Consider the recursive method myprint in this code snippet: public void myprint(int n) { if (n &lt; 10) { system.out.print(n); }
    5·1 answer
  • Peter has recently bought a media player and a digital camera he wants to buy a memory card and then use devices which memory do
    11·2 answers
  • The mathematical constant Pi is an irrational number with value approximately 3.1415928... The precise value of this constant ca
    12·1 answer
  • What the meaning of ethics
    14·1 answer
  • If the algorithm does not have instructions for unanticipated results, the computer program will
    15·1 answer
  • Importance of folders on a computer <br>​
    10·1 answer
  • Write a pseudocode for the logic of a program that accepts five numbers from a user and displays one of the following messages:-
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!