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
Write a program whose input is a character and a string, and whose output indicates the number of times the character appears in
Delvig [45]

Answer:

// program in java.

import java.util.*;

// class definition

class Main

{

   // main method of the class

public static void main (String[] args) throws java.lang.Exception

{

   try{

    // object to read input  

Scanner scr=new Scanner(System.in);

 System.out.print("Enter the String:");

  // read string from user

   String str=scr.nextLine();

System.out.print("Enter the character:");

 // read character

char ch=scr.next().charAt(0);

  // variable to count the occurrence of character  

   int char_count=0;

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

   {

   // find the character i string

       if(ch==str.charAt(i))

       // increase the count

       char_count++;

   }

   // print the count

   System.out.println("count of "+ch+" in the String is:"+char_count);

   }catch(Exception ex){

       return;}

}

}

Explanation:

Read a string from user and assign it to variable "str".Then read a character to  and assign it to variable "ch".Then Declare a variable "char_count" to count the  occurrence of character in the string.Find the count of character in the string. Here upper case character is different than lower case.  

Output:

Enter the String:Monday                                                                                                    

Enter the character:n                                                                                                      

count of n in the String is:1

Enter the String:Nobody                                                                                                    

Enter the character:n                                                                                                      

count of n in the String is:0                                                                                              

                             

5 0
3 years ago
Switched Ethernet, similar to shared Ethernet, must incorporate CSMA/CD to handle data collisions. True False
valentinak56 [21]

Answer:

False

Explanation:

The Carrier-sense multiple access with collision detection (CSMA/CD) technology was used in pioneer Ethernet to allow for local area networking.  Carrier-sensing aids transmission while the collision detection feature recognizes interfering transmissions from other stations and signals a jam. This means that transmission of the frame must temporarily stop until the interfering signal is abated.

The advent of Ethernet Switches resulted in a displacement of the CSMA/CD functionality.

4 0
3 years ago
Write a program that lets the Michigan Popcorn Company keep track of their sales for seven different types of popcorn they produ
valentina_108 [34]

Answer:

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    // declare and initialize popcorn name array
  6.    string popcorn_name[7] = {"plain", "butter", "caramel", "cheese", "chocolate", "turtle", "zebra"};
  7.    // declare and initialize sales array with 7 elements
  8.    int sales[7];
  9.    
  10.    // A loop to prompt user to enter sales for each popcorn
  11.    for(int i=0; i < 7; i++){
  12.        cout<<"Enter number of sales for " + popcorn_name[i] + " :";
  13.        cin>>sales[i];
  14.    }
  15.    
  16.    // Find maximum sales
  17.    int max = sales[0];
  18.    int maxIndex = 0;
  19.    for(int j=1; j < 7; j++){
  20.        if(max < sales[j]){
  21.            max = sales[j];
  22.            maxIndex = j;
  23.        }
  24.    }
  25.    
  26.    // Find minimum sales
  27.    int min = sales[0];
  28.    int minIndex = 0;
  29.    for(int k=1; k < 7; k++){
  30.        if(min > sales[k]){
  31.            min = sales[k];
  32.            minIndex = k;
  33.        }
  34.    }
  35.    
  36.    // Print popcorn name and sales
  37.    for(int l=0; l < 7 ; l++){
  38.        cout<<popcorn_name[l]<<"\n";
  39.        cout<<"Sales: "<< sales[l]<<"\n\n";
  40.    }
  41.    
  42.    // Print popcorn name with maximum and minimum sales
  43.    cout<<"Highest selling: "<< popcorn_name[maxIndex]<<"\n";
  44.    cout<<"Lowest selling: "<<popcorn_name[minIndex]<<"\n";
  45.    return 0;
  46. }

Explanation:

Create two arrays to hold the list of popcorn name and their sales (Line 5-8). Next prompt user to input the sales for each popcorn (Line 10-14). Get the maximum sales of the popcorn (Line 17-24) and minimum sales (Line 27-34). Print the popcorn name and sales (Line 37-40) and the popcorn name with highest and lowest selling (Line 43-44).

5 0
3 years ago
"The ability to assign system policies, deploy software, and assign permissions and rights to users of network resources in a ce
Hatshy [7]

Answer:

Active Directory

Explanation:

The 2012 R2 Windows Server  is the 6th version of  Windows Server server operating system which is made by Microsoft. It is a part of the Windows NT family of the operating systems.

Active Directory helps to store the default user profiles as well as the user login scripts.

It helps to assign the system policies, assign  permission to the users overt he network resources and also to deploy software in a centralized manner.

3 0
3 years ago
The overall cost of wiring in addressable fire alarm system is significantly cheaper than the conventional one. Why is it so?
stellarik [79]

Answer:

Yes, The overall cost of wiring in addressable fire alarm system is significantly cheaper than the conventional one.But the addressale fire alram system is more reliable than a conventional system.

Explanation:

Conventional systems are hardware-based and use analog technology. where addressable fire alarm use digital technology. addressable system is generally more reliable than a conventional system mainly due to how the different systems are wired. With a conventional system, if a device’s wire is damaged or severed, its signal and the signal of other devices down the line cannot be transmitted to the control panel.

With an addressable system, both ends of the wire connect to the control panel. Therefore, if one end becomes damaged or severed, signals can still reach the control panel through the other end of the loop. In addressable systems, a device can be removed or disabled and it will not affect the other devices in the loop.

7 0
3 years ago
Other questions:
  • Barry was giving a sales presentation to a client. He noticed that the client kept his eyes glued on the slide rather than looki
    15·2 answers
  • As you apply to college when should you apply for financial aid
    9·1 answer
  • Renee's creating a plan for her business's information system. What should she do after she determines the goals for her busines
    10·1 answer
  • At Tech Edge Inc., a special team is set up for making a robot capable of assisting blind people in daily activities. The member
    5·1 answer
  • Cryptography has requirements include:
    8·1 answer
  • People who rely on others for financial support, such as children and the elderly, are referred to as 16 O A. recipients O B. be
    9·1 answer
  • Join me in mincraft I will tell you my code if you want to join and the mincraft I play is mincraft education edition
    8·2 answers
  • Calculate the value of z. Given v=4, w=5, x=8, y=2z= (v+ w) * x / y;print (“value of z is “, z)
    8·1 answer
  • An 802. 11 frame contains a number of fields. Which field describes the version of 802. 11 that is being used?
    10·1 answer
  • Given the tables PRODUCT (ProductID. Description. Cost) SUPPLIER (Supplier D. ContactName, Phone Number) as shown in the figure
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!