Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find the five errors in the below code segment and rectify them 1. class SubscriptValidation 2. { 3. static void main() 4. { 5. int[]

Find the five errors in the below code segment and rectify them

1. class SubscriptValidation

2. {

3. static void main()

4. {

5. int[] array = ( 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 );

6. int sub;

7. const int QUIT = 99;

8. Console.Write("Enter a subscript value or {0} to quit >> ", QUIT);

9. sub = Convert(Console.ReadLine());

10. while (sub != QUIT)

11. {

12. Try

13. {

14. Console.WriteLine("The value is {0}", array[sub]);

15. }

16. catch (IndexOutOfRangeException e)

17. {

18. Console.WriteLine(e.Message);

19. }

20. Console.Write("Enter a subscript value or {0} to quit >> " QUIT);

21. sub = Convert.ToInt32(Console.ReadLine());

22. }

23. }

24. }

....

C# answer asap please!

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

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Use good transitions

Answered: 1 week ago