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
An attacker gained remote access to a user's computer by exploiting a vulnerability in a piece of software on the device. The at
Anni [7]

"A Buffer overflow" vulnerability exploit resulted from the attacker's actions.

Whenever a software or an application writes too much data into a buffer, causing neighboring storage regions to have been corrupted as a consequence, this could be determined as Buffer overflow.

⇒ There are two kinds of Buffer overflow attacks such as:

  • <u>Stack-based</u> - It will become more popular to use such memory, as well as that's only available during implementation of any code.
  • <u>Heap-based</u> - Those attacks seem to be more difficult to execute because they entail overflowing overall storage capacity allotted for a program further than the space needed for something like the program's present activities.

Thus we can say that the correct answer is a Buffer overflow.

Learn more about Buffer overflow here:

brainly.com/question/4952591

6 0
2 years ago
2.
Masja [62]

Answer:

is this a question or not?

6 0
3 years ago
Dani wants to create a web page to document her travel adventures. Which coding language should she use? HTML Java Python Text
FromTheMoon [43]

Answer:

<h2>I would recommend Python Programming language</h2>

Explanation:

The major reason i recommend python is that It has a ton of resources, and community support, such that it is practically impossible to get stuck while carrying out a project

Python is easy,and lets you build more functions with fewer lines of code.

More so, provides a stepping stone to learning other code and it is a very  flexible language

3 0
3 years ago
Type the correct answer in the box. Spell the word correctly.
Liono4ka [1.6K]

Translators convert code written in a high-level language to the machine language.

4 0
3 years ago
Read 2 more answers
The __________ certification program has added a number of concentrations that can demonstrate advanced knowledge beyond the bas
Sophie [7]

Answer:

CISSP

Explanation:

The CIDDP concentrations are an extension and development on the knowledge and credentials of the standard CISS certification that improves employability and career advancement

The CISSP concentrations includes

Information System Security Architecture Professional which can be known as ISSAP

Information System Security Engineering Professional which can be known as ISSEP

Information System Security Management Professional which can be known as ISSMP.

4 0
3 years ago
Other questions:
  • Numbering exception conditions, which often uses hierarchical numbering, in a fully developed use case description is helpful to
    7·1 answer
  • Ryan is the operations manager for a national financial company. His company is in the process of creating a customer handbook.
    13·1 answer
  • You are asked to design a system of FP numbers representation (with your own design choices), labeled Custom_FP_48, for which we
    8·1 answer
  • 1. The programmer intends for this pseudocode to display three random numbers in the range of 1 through 7. According to the way
    12·1 answer
  • You are almost finished updating a Website. As part of the update, you have converted all pages from HTML 4.0 to HTML5. The proj
    7·1 answer
  • Mad Libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (a
    14·1 answer
  • Can anyone please help me to solve this question?
    10·1 answer
  • Short note about micro miniaturzation​
    6·2 answers
  • What study skill is being used when taking a large project and breaking it down into smaller manageable tasks?
    5·2 answers
  • A relational database contains a series of _____ that can be connected to form relationships.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!