Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How do I solve this error in the code? Code: import java.util.Scanner; public class CourseGradePrinter { public static void main (String [] args) { final

How do I solve this error in the code?

Code:

import java.util.Scanner;

public class CourseGradePrinter { public static void main (String [] args) { final int NUM_VALS = 4; int[] courseGrades = new int[NUM_VALS]; int i;

courseGrades[0] = 7; courseGrades[1] = 9; courseGrades[2] = 11; courseGrades[3] = 10;

for(i=0;i

{

System.out.print(courseGrades[i]+" ");

}

System.out.println();

for(i=courseGrades.length-1;i>=0;i--)

{

System.out.print(courseGrades[i]+" ");

}

} }

Error:

image text in transcribed

Run Testing for courseGrades-(7, 9, 11, 10) Output is nearly correct; but whitespace differs. See highlights below. Special character legend 7 9 11 1O 10 11 97 Your output 7 9 11 1O Expected output 10 11 97 XTest aborted

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions

Question

Strong analytical, communication, and problem-solving skills

Answered: 1 week ago