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
gtnhenbr [62]
3 years ago
14

Write a loop that sets newScores to oldScores shifted once left, with element 0 copied to the end. Ex: If oldScores = {10, 20, 3

0, 40}, then newScores = {20, 30, 40, 10}. Note: These activities may test code with different test values. This activity will perform two tests, the first with a 4-element array (newScores = {10, 20, 30, 40}), the second with a 1-element array (newScores = {199}). See "How to Use zyBooks". . Also note: If the submitted code tries to access an invalid array element, such as newScores[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.
Computers and Technology
1 answer:
poizon [28]3 years ago
5 0

Answer:

int[] newScores = new int[oldScores.length];

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

   if (i==oldScores.length-1){

        newScores[oldScores.length-1] = oldScores[0];

   } else {

        newScores[i] = oldScores[i+1];

   }

}

Explanation:

Code is written in Java

You might be interested in
Which kind of image is indispensable and needs added text to go with it? A. a map B. a chart C. a graph D. a photograph
Serhud [2]

I'm going to say a chart.  I could be wrong.  If the chart didn't have text with it- how do you know what the chart is for?


A map, it needs text, but these days people just use GPS's.

4 0
3 years ago
Read 2 more answers
One of the most toxic components of a computer is the _____.
defon

I would say A. because that is true but mostly for older computers

4 0
4 years ago
What is one reason to create a study check list​
grigory [225]
To make sure you studied everything you need to know.
4 0
3 years ago
What is the dark, sticky substance that forms when tobacco is burned?
sashaice [31]

Answer: Tar.

Explanation:

A chemical substance made when tobacco is burned. Tar contains most of the cancer-causing and other harmful chemicals found in tobacco smoke. When tobacco smoke is inhaled, the tar can form a sticky layer on the inside of the lungs.

7 0
3 years ago
Write a program that receives a series of numbers from the user and allows the user to press the enter key to indicate that he o
Dmitriy789 [7]

Answer:

The solution code is written in Python 3

  1. count = 0
  2. sum = 0
  3. num = input("Enter a number: ")
  4. while(num != ''):
  5.    sum += float(num)
  6.    count += 1
  7.    num = input("Enter a number: ")
  8. print("Sum : " + str(sum))
  9. print("Average: " + str(sum / count))

Explanation:

Firstly, we declare two variables count and sum to hold the number of input number and the total of the input number, respectively (Line 1-2)

Next, we prompt user to input the first number (Line 4). While the num is not ' ' (This means it is not "Enter" key), accumulate the num to sum variable and increment count by one (Line 6-8) and then prompt the user to input the next number (Line 9).

At the end, display the sum and average using print function (Line 11 -12).

5 0
4 years ago
Other questions:
  • Which of the following is false?
    7·1 answer
  • Before text can be formatted you must first
    10·2 answers
  • A computer that no longer works after having minor repair work done to it may have been damaged by ____
    13·2 answers
  • How can an installation be a tool for community building?
    9·1 answer
  • Having friends who cause you stress can decrease your happiness, which can in turn
    13·2 answers
  • What is the purpose of a forecast worksheet?
    15·1 answer
  • Can we update App Store in any apple device. (because my device is kinda old and if want to download the recent apps it aint sho
    10·1 answer
  • Who when and why developed python​
    9·2 answers
  • What is the final step when creating an appointment to ensure that the content of the appointment is stored in Outlook?
    13·1 answer
  • Write a C program that reads two hexadecimal values from the keyboard and then stores the two values into two variables of type
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!