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]
4 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]4 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
How can aspiring illustrators hone their skills?
user100 [1]

Answer:

Adobe Premiere

Reason: Adobe offers a range of software to practice and master the craft

6 0
3 years ago
Which is said to be ‘computer on a chip’ (a) Micro processors (b) Microcontrollers (c) Both (c) None of the above
fiasKO [112]
I think the answer would be A
5 0
3 years ago
A call center company wants to implement a domain policy primarily for its shift workers. The call center has large groups with
spayn [35]

In my opinion, the best solution for the call center company to implement is to enforce time of day restrictions.

D) Time-of-day restrictions.

<u>Explanation:</u>

As the employees of the call-center company work in shifts, it would be the best solution to incorporate time of day restrictions. Each employee has already been allotted a shift, so every employee should only be allowed to log in when their shift is active.

Reduced failed logon attempts, mandatory password changes, and increased account-lockout time are also good practices to incorporate but the performance of the shift will be best monitored when the time of day restrictions are made.

In this way, the company will know who all from the employees are allowed to log in and it will subsequently decrease the traffic as well.

7 0
3 years ago
Based on a kc value of 0.150 and the data table given, what are the equilibrium concentrations of xy, x, and y, respectively?
lidiya [134]

If the solution process is endothermic, then an increase in temperature usually results in an increase in solubility. Their heat of reaction is usually positive. The rest of the choices do not answer the question above.

4 0
3 years ago
Which of the following devices is used to connect multiple devices to a network and sends all traffic to all connected devices?
Stels [109]

Answer: HUB

Explanation:

A Hub is a network device, that acts only in layer 1 (Physical layer) forwarding all traffic that reaches to the input port, to all output ports at once, without processing the received data in any way that could modify them.

It behaves like it were a multiport repeater (which has only one output port).

5 0
3 years ago
Other questions:
  • after turning the volume all the way up on the speakers, you still cannot hear any sound. which of the following should be your
    9·1 answer
  • What is the correct method to use Dreamweaver to find broken links and orphaned files?
    15·1 answer
  • Jenna wants to convert a decimal number to its octal form. Which option will she use to calculate the octal number?
    8·1 answer
  • You can use______ in order to allow the user to browse and find a file at run time.
    15·1 answer
  • Xavier would like to change the sort options for his contacts. In which tab will he find the Arrangement command group?
    6·1 answer
  • Explain how class (static) variables and methods differ from their instance counterparts. Give an example of a class that contai
    7·1 answer
  • What is the primary difference between the windows server 2012 r2 server manager and previous versions (before windows server 20
    11·1 answer
  • Consider two different implementations of the same instruction set architecture (ISA). The instructions can be divided into four
    14·1 answer
  • If you change the text to bold,you are changing the what?
    9·1 answer
  • 11. a) What is character size measured in?
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!