subject
Computers and Technology, 07.05.2021 19:40 gggg79

Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print: 7 9 11 10 10 11 9 7
Hint: Use two for loops. Second loop starts with i = courseGrades. length - 1.
Note: These activities may test code with different test values. This activity will perform two tests, both with a 4-element array. Also note: If the submitted code tries to access an invalid array element, such as courseGrades[9] for a 4-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message.
import java. util. Scanner;
public class CourseGradePrinter {
public static void main (String [] args) {
Scanner scnr = new Scanner(System. in);
final int NUM_VALS = 4;
int [] courseGrades = new int[NUM_VALS];
int i;
for (i = 0; i < courseGrades. length; ++i) {
courseGrades[i] = scnr. nextInt();
}
/* Your solution goes here */
}
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 10:50
Using least squares fitting, you are to fit the data sets to the following models and solve for the parameters ai , where i is the index of the parameter. the input/output data for the systems are linked in the bblearn site. for each of the systems use matlab to plot the supplied data vs. the model fit on one plot. include your code in the solutions. (a) linear fit "lineardata.mat" y=a1x^3 + a2x^2 + a3x + a4 (b) plant fit "plantdata.mat g(s) = a1/(s + a2)
Answers: 1
question
Computers and Technology, 22.06.2019 12:00
Which of the following does 3d animation create an illusion of on the screen? a. depth b. emotion c. length d. dialogue
Answers: 1
question
Computers and Technology, 22.06.2019 19:30
When creating a presentation in libre office impress, where does the editing of slides take place?
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Best laptops for college [$100-$500 range]?
Answers: 2
You know the right answer?
Write a for loop to print all elements in courseGrades, following each element with a space (includi...
Questions
question
Mathematics, 27.10.2020 20:00
question
History, 27.10.2020 20:00
question
Mathematics, 27.10.2020 20:00
question
Mathematics, 27.10.2020 20:00
question
Spanish, 27.10.2020 20:00
Questions on the website: 13722362