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
Reil [10]
3 years ago
8

Write a loop that sets new scores to old scores shifted once left, with element 0 copied to the end. ex: if old scores = {10, 20

, 30, 40}, then newscores = {20, 30, 40, 10}.
Computers and Technology
2 answers:
olganol [36]3 years ago
5 0

For the given problem, define the size equal to 4 since four scores are given. Now, create two arrays: one for storing old score values and second for storing new score values. After this, assign old scores in an array and then create a loop that will shift the old score from second element until the one less than the size . Now, display the old scores and new scores as shown in output.

Further explanation:

Code:

The Java code to set the new scores from given old scores is as given below:

//Define the StudentScore class

public class StudentScores

{

//main method

public static void main(String[] args)

{

//Define final variable

final int SCORES_SIZE=4;

//Create two array

int[] oldScores = new int[SCORES_SIZE];

int[] newScores = new int[SCORES_SIZE];

//Declare a variable

int i = 0;

//Assign values to array

oldScores[0]=10;

oldScores[1]=20;

oldScores[2]=30;

oldScores[3]=40;

/*Your solution goes here*/

int firstOldScore=oldScores[0];

//Run for loop to shift the old score from second element until the one less than the size

for(int index=0;index<SCORES_SIZE-1;index++)

{

//shift oldScores to newScores

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

}

newScores[SCORES_SIZE-1]=firstOldScore;

System.out.println("oldScores:");

for(i=0;i<SCORES_SIZE;++i)

{

// Display the oldScores

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

}

System.out.println();

// Print the new scores

System.out.println("newScores:");

for (i=0;i<SCORES_SIZE;++i)

{

//Display newScores

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

}

System.out.println();

return;

}

}

Output:

oldScores:

10 20 30 40

newScores:

20 30 40 10

Learn more:

1. How does coding work on computers?  brainly.com/question/2257971

2. Prediction accuracy of a neural network depends on _______________ and ______________. brainly.com/question/10599832  

Answer details:

Grade: College Engineering

Subject: Computer Science

Chapter: Java Programming

Keyword:

Java, input, output, programming, statements,  char, int, variables, file, loop, old scores, new scores, array, size, variable, display

Inga [223]3 years ago
3 0

#include <iostream>
using namespace std;

int main() {
   const int SCORES_SIZE = 4;
   int oldScores[SCORES_SIZE];
   int newScores[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) {
      cout << newScores[i] <<" ";
   }
   cout << endl;

   return 0;
}

You might be interested in
A program that will ring a bell six times is what kind of program?
amm1812

Answer:

D

Explanation:

because it is a sequence it does more than one thing

6 0
3 years ago
Read 2 more answers
What is the different between 32bit anf 64 bit verision​
Elina [12.6K]

<u>The different between 32 bit and 64 bit version:​</u>

  • The main difference between 32-bit and 64-bit versions is that a 32-bit version can access 2^3^2 memory addresses which is roughly equivalent to 4 GB of memory.
  • On the other hand, a 64-bit version can access 2^6^4 memory addresses which equates to a huge amount of memory, 16 exabytes to be precise.  
  • Nowadays, we observe that almost all the computers have 64-bit processors, which means that they can access any amount of memory over 4 GB till 16 exabytes.
  • 64-bit processors have various advantages like the increased speed of operations, smooth multitasking and they can also support video games and software's that have high graphical requirements.
8 0
3 years ago
Anyone knows the answer for 6.1.4 Happy Birthday! codehs
Neko [114]

cvm is good cvm is great

7 0
2 years ago
A user has a network device that streams media to the LAN. The device is visible on the network. All PCs on the LAN can ping the
trasher [3.6K]

Answer: A. Multicast

Explanation:

Here we are given a situation where it is necessary for the device to stream media to all the PCs connected across the LAN. But as the they are unable to stream the media then it is a problem in the multicast TCP/Ip technology.

Multicasting enables to transfer information or messages from one to many or many to many. Here as a single device is responsible for streaming the content to other PCs across the LAN, therefore it is necessary that multicast has been properly implemented.

Option B is incorrect as it is not a scenario of broadcast as in broadcasting all the receivers must get the streaming however here if a PC does not want to receive the media stream it cannot receive for which multicasting is required.

Option C is incorrect as here we are not talking of one to one communication.

Option D is incorrect as here we cannot have more than one route to send the media content except the LAN.

5 0
3 years ago
Does an android tablet have a hard drive
Kisachek [45]
No, it uses flash menory
3 0
3 years ago
Other questions:
  • A modern information-processing model that views memories as emerging from particular activation patterns within neural networks
    6·1 answer
  • HURRY
    5·1 answer
  • How does modularity provide flexibility in a structured programming design?
    6·1 answer
  • True / False<br> The exponent in floating point is stored as a biased value.
    9·1 answer
  • Explain why professional software that is developed for a customer is not simply the programs that have been developed and deliv
    13·1 answer
  • This is pixlr
    6·1 answer
  • First Person Who Answers Fast As Possible Will Be Marked As Brainiest ​
    12·1 answer
  • HOW TO GET RID OF THESE LINES?? PLS WILL GIVE BRAINLIEST
    8·2 answers
  • Which of the following best explains how algorithms that run on a computer can be used to solve problems?
    5·1 answer
  • The Texas Department of Education has offices throughout the state covering more than 268,000 square miles. State documents are
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!