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
muminat
3 years ago
11

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 */
}
}
Computers and Technology
1 answer:
ozzi3 years ago
6 0

Answer:

The missing part of the code is:

for (i = 0; i < courseGrades.length; ++i) {

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

       System.out.println();

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

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

       System.out.println();

Explanation:

This iterates through the array

for (i = 0; i < courseGrades.length; ++i) {

This prints each element of the array followed by a space

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

This prints a newline at the end of the loop

       System.out.println();

This iterates through the array in reverse

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

This prints each element of the array (reversed) followed by a space

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

This prints a newline at the end of the loop

       System.out.println();

You might be interested in
Deciding whether to explode a process further or determine that it is a functional primitive is a matter of experience, judgment
pickupchik [31]

Answer:

The answer is "True".

Explanation:

The conceptual, abstract design is also known as a logical design. This design doesn't use to discuss in matter of the actual execution. It only has to identify the kinds of information.  

  • In the logical development process, it involves inserting information into a number, which includes the organizations and features of rational networks.
  • It is used to organize the entities, for example, tables for a relation database, in a given market environment into the database systems, that's why the given statement is true.
3 0
3 years ago
Write code that prints: Ready! userNum ... 2 1 Go! Your code should contain a for loop. Print a newline after each number and af
Vinvika [58]

Answer:

Kindly find the code snippet in the explanation written in kotlin language

Explanation:

fun main(args: Array<String>) {

   var num:Int

   println("Enter a num")

    num= Integer.valueOf(readLine())

   for(i in num downTo 1){

       if(i==num){

           print("Ready!")

           print(" ")

       }

       print(i)

       print(" ")

       if(i==1){

           print(" ")

           print("Go!")

       }

   }

}

This function too can also work

fun numTo(num:Int){

   if (num>0) for(i in num downTo 1) print("$i ")

   println("Go!")

8 0
3 years ago
What are the meaning master files<br>​
Ronch [10]

Answer:

A collection of records pertaining to one of the main subjects of an information system, such as customers, employees, products and vendors.

Explanation:

7 0
3 years ago
Larry does not want to save his Internet browsing details on his computer what files delete to clear his information from the co
GREYUIT [131]
He would have to clear his history or use incognito tabs from then on.
5 0
4 years ago
The purpose of​ a/an _________ system is to capture best practice solutions and program them into a set of rules in a software p
Dmitriy789 [7]
The purpose of an expert system is to capture best practice solutions and program them into a set of rules in a software program. Expert systems are computers that use artificial intelligence technologies to simulate a behavior of a human or another subject. 
The knowledge about a specific subject is transformed with this system into a software code. 
8 0
3 years ago
Other questions:
  • 3. What are the first steps that you should take if you are unable to get onto the Internet? (1 point)
    15·1 answer
  • Which one of the following items is an example of software?
    12·2 answers
  • python (Business: check ISBN-10) An ISBN-10 (International Standard Book Number) consists of 10 digits: d1d2d3d4d5d6d7d8d9d10. T
    12·1 answer
  • A technician is configuring a new SOHO multifunction wireless router at a customer’s location to provide network access to sever
    12·1 answer
  • In one to two sentences, explain why citizens pay taxes
    8·1 answer
  • What do financial planning skills ultimately enable an individual to do?
    10·2 answers
  • A major public university graduates approximately 10,000 students per year, and its development office has decided to build a We
    10·1 answer
  • PLZZZZZZZZZZ HELP ME OUT THIS DUE TODAY AND NEED SOMEONE HELP!!!!!plzzzzzzzzzzz i begging you!!!
    11·1 answer
  • Which tab on the ribbon in the folder window allows users to change how the contents of the folder are being shown?
    11·1 answer
  • The data _____ component of a database management system (DBMS) is used to create and maintain the data dictionary.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!