*in java* Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.   import java.util.Scanner; public class SumOfExcess { public static void main (String [] args) { Scanner scnr = new Scanner(System.in); final int NUM_VALS = 4; int[] testGrades = new int[NUM_VALS]; int i; int sumExtra = -9999; // Assign sumExtra with 0 before your for loop for (i = 0; i < testGrades.length; ++i) { testGrades[i] = scnr.nextInt(); } /* Your solution goes here */ System.out.println("sumExtra: " + sumExtra); } }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter6: Using Arrays
Section: Chapter Questions
Problem 18RQ
icon
Related questions
Question
100%

*in java* Array testGrades contains NUM_VALS test scores. Write a for loop that sets sumExtra to the total extra credit received. Full credit is 100, so anything over 100 is extra credit. Ex: If testGrades = {101, 83, 107, 90}, then sumExtra = 8, because 1 + 0 + 7 + 0 is 8.

 

import java.util.Scanner;

public class SumOfExcess {
public static void main (String [] args) {
Scanner scnr = new Scanner(System.in);
final int NUM_VALS = 4;
int[] testGrades = new int[NUM_VALS];
int i;
int sumExtra = -9999; // Assign sumExtra with 0 before your for loop

for (i = 0; i < testGrades.length; ++i) {
testGrades[i] = scnr.nextInt();
}

/* Your solution goes here */

System.out.println("sumExtra: " + sumExtra);
}
}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

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
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,