1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
meriva
3 years ago
6

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 = NUM_VALS - 1.


Note: These activities may test code with different test values. This activity will perform two tests, the first with a 4-element array (int courseGrades[4]), the second with a 2-element array (int courseGrades[2]). See How to Use zyBooks.

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.

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 = 0;

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


return;
}
}
Computers and Technology
1 answer:
KatRina [158]3 years ago
4 0

Answer:

Java code explained below

Explanation:

CourseGradePrinter.java

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 = 0;

courseGrades[0] = 7;

courseGrades[1] = 9;

courseGrades[2] = 11;

courseGrades[3] = 10;

for(i=0; i<NUM_VALS; i++){

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

}

System.out.println();

for(i=NUM_VALS-1; i>=0; i--){

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

}

return;

}

}

Output:

7 9 11 10

10 11 9 7

You might be interested in
Skinner designed a soundproof apparatus, often equipped with a lever or bar, with which he conducted his experiments in operant
Jlenok [28]

Answer: Skinner box

Explanation: Skinner box is referred as the environment to conduct an experiment to observe the natural behavior of the element in a chamber. The Skinner box is also known as operant conditioning chamber. It is most commonly used for the experiments to be conducted with the animals in the operant conditioning chamber for the research purpose.

It is also soundproof tool and also refereed as the lever box as it contains lever .Thus the answer is Skinner box.

5 0
3 years ago
application that will perform a lot of overwrites and deletes of data and requires the latest information to be available anytim
o-na [289]

Answer:

RDS.

Explanation:

A corporation has implemented a software that conducts the number of information overwriting and deleting, which allows the newest details to be accessible whenever the information is examined. As a Software Engineer, they suggest RDS database technologies.

It is an AWS supported controlled SQL DB service that also reinforces the array type DB for the purpose to contain and maintain the information.

3 0
3 years ago
Select the steps for adding artwork into a placeholder on a presentation slide
Sloan [31]

Answer:

   Open the presentation that you want to add a slide to.

   In the pane that contains the Outline and Slides tabs, click Slides, and then click where you want to add a slide.

Explanation:

6 0
3 years ago
Computer-generated color images of the brain that provide information about brain activity and glucose metabolism are produced b
frozen [14]

The answer to this question is the PET scan. Positron Emission Tomography or PET scan is an imaging test that checks and trace for diseases in the body. This also shows how the body organs is functioning / working. The doctor can evaluate the function of the patients body by the 3D color images produced by the PET Scan.  

4 0
3 years ago
You have an inventory chart in Excel that you would like to include in a Word budget document. You want to make sure that any ch
hram777 [196]

Answer:

The paste function to use when you want to ensure that variations in an Excel chart from an Excel file (source) are updated on the Word document (target file) is the:

Link and Keep Source Formatting function.

Cheers!

8 0
3 years ago
Other questions:
  • Select the correct statement(s) regarding digital baseband modulation.
    7·1 answer
  • The factorial of an integer N is the product of the integers between 1 and N, inclusive. Write a while loop that computes the fa
    10·1 answer
  • Where is the worlds biggest cookie​
    7·2 answers
  • Hi wanna play fortnite tomorrow add me im batjoker09 no caps or spaces
    13·1 answer
  • What do you hope will be in/added GTA 6?
    13·1 answer
  • Which statement about routers is !!!FALSE!!!
    10·1 answer
  • What is the process of smaw welding​
    11·1 answer
  • imagine that you wanted to write a program that asks the user to enter in 5 grade values. the user may or may not enter valid gr
    12·1 answer
  • TECHNICAL TERMS: the adderess of a website
    6·1 answer
  • Write a function called st_dev. st_dev should have one
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!