A My Home Programming Exercise 7 A Courses Tasks TypingGrades.cs + >- Terminal 1 using System; 2 using statie System.Console: 3 elass TypingGrades 4 { Enter number of words typed: 76 O Catalog and Study Tools Grade of F given correctly Unhandled Exception: System. IndexOutOfRangeException: Index was outside the bounds of the array. at TypingGrades. Main () (Ox00066) in (6c4bfe631e3047a 2ad7cbef62348dec1>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System. IndexOutof Ran geException: Index was outside the bounds of the array. at TypingGrades. Main () [Ox0066] in (6c4bfe631e3047a 2ad7cbef62348dec1>:0 I Rental Options La Grade of D given correctly statie void Main() 6 5 * college Success Tips //Arrays int[) words = new int[5]{0, 16, 31, 51, 76); string[) grade new string(5){"E", "D", "C", "B", "A"}; Grade of C given correctly * Career Success Tips RECOMMENDED FOR YOU Grade of B given correctly > 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 } 26 / Enter words typed Write("Enter number of words typed: "): int wordsTyped - Convert. ToInt32(ReadLine()): Grade of A given correctly 000 for(int i = 0;i< words. Length; i++) How to Answer Essay Questions O out of 1 checks passed. Review the results below for more details. if (wordsTyped > words(1) 66 wordsTyped < words(1+1]) Writeline("): Writeline("Typing (0} words per minute: Grade (1}", wordsTyped, grade[i]); Checks O Help Test Case Ineemplete Q Give Feedback 120 words per minute - Grade A Input 120 Output Enter number of words typed: Unhandled Exception: System. Indexoutof RangeException: Index was outside the bounds of the at Typingarades. Main () [Ox00066) in c6c4bfe63le3047a2ad7cbef6234E [ERROR) FATAL UNHANDLED EXCEPTION: System. IndexOutofRangeException: at Typingorades.Main () [Ox00066) in cec4bfe63le3047a2ad7cbef6234

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter12: Adding Functionality To Your Classes
Section12.2: Providing Class Conversion Capabilities
Problem 2E
icon
Related questions
Question

I keep getting out of bounds errors for an array when trying to enter a number 76 or higher for A grade. Idk how to fix it. appreciate all help

A My Home
Programming Exercise 7
Tasks
TypingGrades.cs
+
>_ Terminal
Courses
1 using System;
2 using static System.Console;
3 class TypingGrades
4 {
static void Main()
{
//Arrays
int[] words = new int[5]{0, 16, 31, 51, 76};
string[] grade
Enter number of words typed: 76
O Catalog and Study Tools
Grade of F given correctly
>
A-Z
Unhandled Exception:
BE Rental Options
System. IndexOutOfRangeException: Index was outside the
bounds of the array.
at TypingGrades. Main () [Øx00066] in <6c4bfe631e3047a
2ad7cbef62348d0c1>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRan
geException: Index was outside the bounds of the array.
at TypingGrades. Main () [0x00066] in <6c4bfe631e3047a
2ad7cbef62348d0c1>:Ø
Grade of D given correctly
College Success Tips
</>
7
Grade of C given correctly
>
Career Success Tips
8.
= new string[5]{"F", "D", "C",
"B", "A"};
Grade of B given correctly
>
RECOMMENDED FOR YOU
10
// Enter words typed
Write("Enter number of words typed: ");
int wordsTyped
11
12
Grade of A given correctly
13
= Convert.ToInt32(ReadLine());
0.00
out of
10.00
14
for(int i = 0; i < words.Length; i++)
{
if (wordsTyped >= words[i] && wordsTyped < words[i+l])
{
WriteLine("");
WriteLine("Typing {0} words per minute: Grade {1}", wordsTyped, grade[i]);
}
}
15
How to Answer Essay
16
Questions
O out of 1 checks passed. Review the results below for more details.
17
18
Checks
19
Help
20
Test Case • Incomplete
21
Q Give Feedback
22
120 words per minute - Grade A
23
}
25 }
Input
|24
26
120
Output
Enter number of words typed:
Unhandled Exception:
System. IndexOutOfRangeException: Index was outside the bounds of the
at TypingGrades. Main () [0x00066] in <6c4bfe631e3047a2ad7cbef62348
[ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException :
at TypingGrades. Main () [0x00066] in <6c4bfe631e3047a2ad7cbef62348
Results
Typing 120 words per minute: Grade A
Expected Output e
Typing 120 words per minute: Grade A
Run checks
A Submit 80%
>
!!!
Transcribed Image Text:A My Home Programming Exercise 7 Tasks TypingGrades.cs + >_ Terminal Courses 1 using System; 2 using static System.Console; 3 class TypingGrades 4 { static void Main() { //Arrays int[] words = new int[5]{0, 16, 31, 51, 76}; string[] grade Enter number of words typed: 76 O Catalog and Study Tools Grade of F given correctly > A-Z Unhandled Exception: BE Rental Options System. IndexOutOfRangeException: Index was outside the bounds of the array. at TypingGrades. Main () [Øx00066] in <6c4bfe631e3047a 2ad7cbef62348d0c1>:0 [ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRan geException: Index was outside the bounds of the array. at TypingGrades. Main () [0x00066] in <6c4bfe631e3047a 2ad7cbef62348d0c1>:Ø Grade of D given correctly College Success Tips </> 7 Grade of C given correctly > Career Success Tips 8. = new string[5]{"F", "D", "C", "B", "A"}; Grade of B given correctly > RECOMMENDED FOR YOU 10 // Enter words typed Write("Enter number of words typed: "); int wordsTyped 11 12 Grade of A given correctly 13 = Convert.ToInt32(ReadLine()); 0.00 out of 10.00 14 for(int i = 0; i < words.Length; i++) { if (wordsTyped >= words[i] && wordsTyped < words[i+l]) { WriteLine(""); WriteLine("Typing {0} words per minute: Grade {1}", wordsTyped, grade[i]); } } 15 How to Answer Essay 16 Questions O out of 1 checks passed. Review the results below for more details. 17 18 Checks 19 Help 20 Test Case • Incomplete 21 Q Give Feedback 22 120 words per minute - Grade A 23 } 25 } Input |24 26 120 Output Enter number of words typed: Unhandled Exception: System. IndexOutOfRangeException: Index was outside the bounds of the at TypingGrades. Main () [0x00066] in <6c4bfe631e3047a2ad7cbef62348 [ERROR] FATAL UNHANDLED EXCEPTION: System.IndexOutOfRangeException : at TypingGrades. Main () [0x00066] in <6c4bfe631e3047a2ad7cbef62348 Results Typing 120 words per minute: Grade A Expected Output e Typing 120 words per minute: Grade A Run checks A Submit 80% > !!!
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr