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
The network layer of the Internet model uses the _____________ protocol to route messages though the network.
RUDIKE [14]

Answer:

Capa de Internet. La capa de Internet, también conocida como capa de red o capa IP, acepta y transfiere paquetes para la red. Esta capa incluye el potente Protocolo de Internet (IP), el protocolo de resolución de direcciones (ARP) y el protocolo de mensajes de control de Internet (ICMP).

Explanation:

3 0
3 years ago
which three objects can be linked or embedded in a word document? A. worksheets, margins, colors B. charts, worksheets, images C
frutty [35]
I would go with B
Charts,worksheets,images
8 0
3 years ago
What are the two most popular applications of theInternet?
fiasKO [112]

Answer:

1) Electronic mailing

2) Web browsing

Explanation:

Electronic mail: For hundreds of millions of individuals, e-mail has become an significant component of private communications, many of whom have substituted it with letters or phone calls. E-mail has become an significant advertising medium in company, especially in cases where time-sensitive demand for products and services.Tickets for an upcoming sporting event, for instance, are sold by sending fans an e-mail message with ticket availability data and prices.

Web browsing: The web browsing is another critically important Internet application. The world of internet is filled with the immense of knowledge, subjects, and solutions. The user browse the internet to look out for the related queries, researches and lot other things.

8 0
3 years ago
The method of loci, peg-word system, substitute word system, and method of word association are all examples of _____.
Yakvenalex [24]
The answer is Mnemonic devices

Mnemonics enable us remember things more easily and often refer to such internal strategies like reciting a rhythm or reciting the order of colors of the rainbow. In cognitive psychology of memory, peg-word method, keyword method, and the method of loci are discussed as formal mnemonic techniques.



5 0
3 years ago
Construct a regular expression that recognizes the following language of strings over the alphabet {0 1}:
vovikov84 [41]

Answer:

00(01)*+|(01)*+101|00(01)*+101

Rest detail is in explanation.

Explanation:

(01)* means all the strings comprising of 0 and 1

when we add + the set includes empty sets as well. and for or we use union, and this can be done using the | sign.

And for concatenation, we have like 00(01)* etc. Hence, the above regular expression.

5 0
3 years ago
Other questions:
  • In order for Dr. Reynolds to send a CPOE from her office computer system to the computer system at the local hospital, a/an ____
    5·1 answer
  • 2.1. The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. F
    10·1 answer
  • Write a function ngrams(n, tokens) that produces a list of all n-grams of the specified size from the input token list. Each n-g
    6·1 answer
  • Select the layer of the OSI model that is responsible for reformatting, compressing, and/or encrypting data in a way that the ap
    14·1 answer
  • What is the name of the process that weighs the alternatives, gathers all necessary information, and can ultimately lead you to
    9·2 answers
  • Match each career to its various job roles. digital media coordinator digital media specialist photographer sound producer creat
    13·1 answer
  • ¿Quién recibe la orden de ejecución de un programa enviada por el usuario?
    9·1 answer
  • The Arizona Department of Transportation has offices throughout the state. State documents are stored on a large server in a cen
    5·2 answers
  • What is the setting an alarm clock output??
    10·1 answer
  • Choose all items that represent examples of good website accessibility.
    8·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!