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
ratelena [41]
3 years ago
13

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}.
Computers and Technology
1 answer:
Katarina [22]3 years ago
7 0

Answer:

The code is as follows:

for(int j = 0; j < newScores.length-1; j++){  

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

           }  

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

Explanation:

This loop iterates through the elements of oldScores

for(int j = 0; j < newScores.length-1; j++){  

This enters the elements of oldScores to newScores starting from the element at index 1

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

           }  

This moves the first element of index 0 to the last index of newScores

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

You might be interested in
How can I make [ print(3 * x) ] into a functional python code?
CaHeK987 [17]

If you're programming in python, you simply have to assign a value to x and then use the print function. For instance,

x = 3

print(3 * x)

9 will be the output. I hope this helps!

5 0
2 years ago
You are the CEO of a large tech company and have just received an angry email that looks like it came from one of your biggest c
sergejj [24]

Answer: as a whale attack

Explanation:

A whale attack is simply refered to as an attack that is utilized by cybercriminals and in this case, a senior player such as the CEO is targeted in the company and the aim is to steal sensitive information from them or steal money or gain access to their computer for fraudulent purposes.

Based on the explanation above, the attack called into is a whale attack.

4 0
2 years ago
Tuklasin<br>awain 2: Grapiko ng Pananagutan<br>Isulat sa graphic organizer pa​
mrs_skeptik [129]
What are you saying????
7 0
2 years ago
Define a member function PrintAll() for class PetData that prints output as follows. Hint: Make use of the base class' PrintAll(
PilotLPTM [1.2K]

Answer:

Following are the program in the C++ Programming Language.

//set header file

#include <iostream>

//set header file for string

#include <string>

//set namespace

using namespace std;

//define class

class AnimalData

{

//set access modifier

public:

//define function

void SetName(string givenName)

{

//initialize the value of function's argument

fullName = givenName;

};

//define function

void SetAge(int numYears)

{

//initialize the value of function's argument

ageYears = numYears;

};  

//here is the solution

//define function

void PrintAll()

{

//print output with message

cout << "Name: " << fullName<<endl;

//print output with message

cout << "Age: " << ageYears<<endl;

};

//set access modifier

private:

//set integer data type variable

int ageYears;

//set string data type variable

string fullName;

};

//define class and inherit the parent class

class PetData: public AnimalData

{

//set access modifier

public:

//define function

void SetID(int petID)

{

idNum = petID;

};

//override the function for print id

void PrintAll()

{

AnimalData::PrintAll();

cout << "ID: " <<idNum ;

};

//set access modifier

private:

//set integer type variables

int idNum,fullName,ageYears;

};

//define main method

int main()

{

//create object of the child class

PetData userPet;

//call function through object

userPet.SetName("Fluffy");

//call function through object

userPet.SetAge (5);

//call function through object

userPet.SetID (4444);

//call function through object

userPet.PrintAll();

cout << endl;

return 0;

}

<u>Output</u>:

Name: Fluffy

Age: 5

ID: 4444

Explanation:

<u>Following are the description of the program</u>:

  • Set required header file and namespace.
  • Define class 'AnimalData' and inside the class, set integer data type variable 'ageYears', string data type variable 'fullName'.
  1. Then, define function 'SetName()' with string data type argument 'givenName' and initialize the value of argument in the string variable.
  2. Then, define function 'SetAge()' with integer data type argument 'numYears' and initialize the value of the argument in the integer variable.
  3. Define function 'PrintAll()' to print the value of the following variables with message.
  • Define class 'PetData' and inherit the parent class in it, then set integer data type variable 'idNum'.
  1. Then, define function 'SetID()' with integer data type argument 'petID' and initialize the value of the argument in the integer variable.
  2. Override the function 'PrintAll()' to print the value of the following variable with message.

Finally, define main method and create the object of the child class, then call the following functions through the class object.

8 0
2 years ago
Select the correct answer.
True [87]

Answer:

office access cars

Explanation:

<em><u>HOPE</u></em><em><u> </u></em><em><u>THIS</u></em><em><u> </u></em><em><u>WILL</u></em><em><u> </u></em><em><u>HELP</u></em><em><u> </u></em><em><u>U</u></em><em><u>,</u></em><em><u> </u></em><em><u>MARK</u></em><em><u> </u></em><em><u>ME</u></em><em><u> </u></em><em><u>AS</u></em><em><u> </u></em><em><u>A</u></em><em><u> </u></em><em><u>BRAINLIST</u></em>

3 0
2 years ago
Other questions:
  • The _______ number system allows digital devices to represent virtually any number simply by using 0s and 1s.
    11·1 answer
  • Although the original BBS system was simple, it increased people's ability to communicate
    14·1 answer
  • In an inheritance situation, the new class that you create from an existing class is known as the:
    5·1 answer
  • Use the image above to determine which toolbars will be displayed in the program you are using. SELECT ALL THAT APPLY
    11·2 answers
  • . A program that can run more than one thread at once is called:
    9·1 answer
  • In a gear system, when you gain torque you lose what?
    11·1 answer
  • At Chicago Cubs games, residents across the street from Wrigley Field can watch the game from their apartment windows. Many of t
    14·1 answer
  • Explain one way in which programmers may get hired.
    9·1 answer
  • Create a query that shows columns employee last name, job title and hire date for those employees who joined the company on or a
    7·1 answer
  • Assume the name of your data frame is flavors_df. What code chunk lets you review the structure of the data frame?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!