Tasks 5.00 out of 10.00 (0) Correctly displays score and offset from average Checks Input Test Case Incomplete Outputs how far score is from average case 1 74 65 34 1 out of 2 checks passed. Review the results below for more details. 25 100 86 47 54 Output Enter test scores: Test #0: 74 From Average: 14 Test #1: 65 From Average: 5 Test #2: 34 From Average: -26 Test # 3: 25 From Average: -35 Test #4: 100 From Average: 40 Test #5: 86 From Average: 26 Test #6: 47 From Average: -13 Test #7: 54 From Average: -6 Results Test #0: 74 From average: 13.375 Test # 1: 65 From average: 4.375 Test # 2: 34 From average: -26.625 Test # 3: 25 From average: -35.625 Test # 4: 100 From average: 39.375 Test # 6: 47 From average: -13.625 Test # 5: 86 From average: 25.375 Test # 7: 54 From average: -6.625 TestScoreList.cs 1 using System; 2 using static System.Console; 3 class Test ScoreList 4 5 { 6 static void Main() 7 { 8 int i, sum = 0, avg = 0; // variable declaration 9 int[] test new int [8]; // array declaration 10 11 Console.WriteLine("Enter test scores: "); 12 for (i = 0; i < 8; i++) // Loop to accept scores 13 { 14 test[i] = int.Parse(Console.ReadLine()); // accept scores 15} 16 17 for (i = 0; i < 8; i++) 18 { 19 sum + test[i]; // calculate sum 20} 21 22 avg = sum / 8; // calculate Average 23 24 for (i = 0; i < 8; i++) 25 { 26 Console.WriteLine("Test #"+i+": "+test[i]+" From Average: "+(test[i]-avg)); // p 27} 28 29 } 30 } 31

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 20PE
icon
Related questions
Question
100%

I am getting the wrong output below 

Programming Exercise 6-2
=
go
Tasks
5.00
out of
10.00
Correctly displays score and offset from average
Checks
Input
Test Case Incomplete
Outputs how far score is from average case 1
74
65
34
25
100
86
47
54
1 out of 2 checks passed. Review the results below for
more details.
Output
Enter test scores:
Test #0: 74 From Average: 14
Test #1: 65 From Average: 5
Test #2: 34 From Average: -26
Test #3: 25 From Average: -35
Test #4: 100 From Average: 40
Test #5: 86 From Average: 26
Test #6: 47 From Average: -13
Test #7: 54 From Average: -6
Results
Test # 0: 74 From average: 13.375 Test # 1: 65 From average: 4.375
Test # 2: 34 From average: -26.625
Test # 3: 25 From average: -35.625
Test # 4: 100 From average: 39.375
Test # 6: 47 From average: -13.625
Show Details
Test # 5: 86 From average: 25.375
Test # 7: 54 From average: -6.625
Run checks
Submit 50%
TestScoreList.cs
1 using System;
2 using static System.Console;
3 class Test ScoreList
+
4
5 {
6 static void Main()
7 {
8 int i, sum = 0, avg = 0; // variable declaration
9 int[] test = new int[8]; // array declaration
10
11 Console.WriteLine("Enter test scores: ");
12 for (i = 0; i < 8; i++) // Loop to accept scores
13 {
14 test[i] = int.Parse(Console.ReadLine()); // accept scores
15}
16
17 for (i = 0; i < 8; i++)
18 {
19 sum + test[i]; // calculate sum
20 }
21
22 avg = sum / 8; // calculate Average
23
24 for (i = 0; i < 8; i++)
25 {
26 Console.WriteLine("Test #"+i+": "+test[i]+" From Average: "+(test[i]-avg)); // prin
27 }
28
29 }
30 }
31
Transcribed Image Text:Programming Exercise 6-2 = go Tasks 5.00 out of 10.00 Correctly displays score and offset from average Checks Input Test Case Incomplete Outputs how far score is from average case 1 74 65 34 25 100 86 47 54 1 out of 2 checks passed. Review the results below for more details. Output Enter test scores: Test #0: 74 From Average: 14 Test #1: 65 From Average: 5 Test #2: 34 From Average: -26 Test #3: 25 From Average: -35 Test #4: 100 From Average: 40 Test #5: 86 From Average: 26 Test #6: 47 From Average: -13 Test #7: 54 From Average: -6 Results Test # 0: 74 From average: 13.375 Test # 1: 65 From average: 4.375 Test # 2: 34 From average: -26.625 Test # 3: 25 From average: -35.625 Test # 4: 100 From average: 39.375 Test # 6: 47 From average: -13.625 Show Details Test # 5: 86 From average: 25.375 Test # 7: 54 From average: -6.625 Run checks Submit 50% TestScoreList.cs 1 using System; 2 using static System.Console; 3 class Test ScoreList + 4 5 { 6 static void Main() 7 { 8 int i, sum = 0, avg = 0; // variable declaration 9 int[] test = new int[8]; // array declaration 10 11 Console.WriteLine("Enter test scores: "); 12 for (i = 0; i < 8; i++) // Loop to accept scores 13 { 14 test[i] = int.Parse(Console.ReadLine()); // accept scores 15} 16 17 for (i = 0; i < 8; i++) 18 { 19 sum + test[i]; // calculate sum 20 } 21 22 avg = sum / 8; // calculate Average 23 24 for (i = 0; i < 8; i++) 25 { 26 Console.WriteLine("Test #"+i+": "+test[i]+" From Average: "+(test[i]-avg)); // prin 27 } 28 29 } 30 } 31
Expert Solution
steps

Step by step

Solved in 5 steps with 2 images

Blurred answer
Knowledge Booster
Array
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning