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
ivann1987 [24]
3 years ago
15

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}).
public class StudentScores {
public static void main (String [] args) {
final int SCORES_SIZE = 4;
int[] oldScores = new int[SCORES_SIZE];
int[] newScores = new int[SCORES_SIZE];
int i = 0;

oldScores[0] = 10;
oldScores[1] = 20;
oldScores[2] = 30;
oldScores[3] = 40;

/* Your solution goes here */

for (i = 0; i < SCORES_SIZE; ++i) {
System.out.print(newScores[i] + " ");
}
System.out.println();

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

Answer:

The code to this question can be given as:

Code:

int lastVector = newScores.size() -1; //define variable lastVector that holds updated size of newScores.

newScores = oldScores; //holds value.

for (i = 0; i < SCORES_SIZE - 1; i++) //define loop.

{  

newScores.at(i) = newScores.at(i+1); //holds value in newScores.

}

newScores.at(lastVector) = oldScores.at(0); //moving first element in last.

Explanation:

  • In the given C++ program there are two vector array is defined that are "oldScores and newScores". The oldScores array holds elements that are "10, 20, 30, 40".
  • In the above code, we remove the array element at first position and add it to the last position. To this process, an integer variable "lastVector" is defined.  
  • This variable holds the size of the newScores variable and uses and assigns all vector array elements from oldScores to newScores. In the loop, we use the at function the removes element form first position and add in the last position.
  • Then we use another for loop for print newScores array elements.  
You might be interested in
What are some things that games were historically used for?
madreJ [45]

Answer:

D) All of the above

Explanation:

All of these options are true.

Hope it helps and is correct!

5 0
2 years ago
Describe four features of a well designed input screen
Sladkaya [172]

Answer:

A well design input screen should:1.Be titled2.Navigation aids should be used

Explanation:

3 0
3 years ago
Read 2 more answers
A company operates on two types of servers: 2 large servers (L) and 4 smaller servers (S), with a combined total of 64GB RAM. Th
kati45 [8]

Explanation:

Let the size of a large server be L, and

the size of a small server be S.

We are given two scenarios,

2L+4S = 64.............(1)

and

L+3S = 40...............(2)

We solve the equations as follows

2(2)-(1)

2L-2L +6S-4S = 2*40-64

2S = 16

so S=8 ..................(3), size of small server

substitute (3) in (2)

L+3(8) =40

L = 40-24 = 16..............size of large server

8 0
3 years ago
The power relationship on a transformer states that O Power in = power out + loss O Power in = 1/2 power out (Power in = 2 x pow
lions [1.4K]

Answer:

D

Explanation:

5 0
3 years ago
Game design is iterative. What does this mean?
Furkat [3]

Answer:  

What does Iterative Game Design mean?

Iterative game design is the process by which a video game is repeatedly proposed, prototyped, play tested and reevaluated prior to working product release. Iterative game design operates on the following principle: It is unrealistic to create an ideal product on the first try.

By creating and testing working models on core criteria (such as fun), game designers are able to refine product on a gradual basis and increase market success potential.

3 0
3 years ago
Other questions:
  • Anicius boethius invented a system that made possible the memorization and written transmission of melodies.
    9·1 answer
  • Part 1 Create a program that asks the user for a temperature in Fahrenheit, and then prints the temperature in Celsius. Search t
    12·1 answer
  • Fill in the correct formula called a contains numbers from Rhodes 1 to 20 you can use the formula blank to find the volume of th
    14·1 answer
  • Which of the following is an example of an application software?
    10·1 answer
  • Has anyone on here heard from lilkoadkmillines?
    10·1 answer
  • 7.2 need help plzs 15 points
    13·1 answer
  • How do I go to files in Brainly I need help
    13·1 answer
  • Which of the following is the best description of an ip address?
    8·1 answer
  • Select the correct answer.
    7·1 answer
  • What is keyword density?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!