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
ycow [4]
4 years ago
8

Assume an int array, candy, stores the number of candy bars sold by a group of children where candy[j] is the number of candy ba

rs sold by child j. Assume there are 12 children in all ,which of the following code could be used to compute the total number of bars sold by the children?
Scanner scan = Scanner.create(System.in); int value1 = scan.nextInt( ); int value2 = scan.nextInt( ); bars[value1] += value2;

1. adds value1 to the number of bars sold by child value2
2. adds 1 to the number of bars sold by child value1 and child value2
3. adds 1 to the number of bars sold by child value1
4. inputs a new value for the number of bars sold by both child value1 and child value2
5. adds value2 to the number of bars sold by child value1
Computers and Technology
1 answer:
Pepsi [2]4 years ago
8 0

Answer:

5. adds value2 to the number of bars sold by child value1

Explanation:

First, the code snippet create a Scanner object called scan.

Then it receive user input as value1. It then also receives another user input as value2.

From the question, we are told that candy[j] is the number of candy bars sold by child j. So, value1 represent number of candy bars by child 1 and value2 represent number of candy bars by child 2.

Therefore;

bars[value1] += value2;

adds value2 to the number of bars sold by child value1

You might be interested in
Briefly describe the fundamental differences between project-based and product-based Software Engineering.
andrew11 [14]

Answer:

Product-based companies make a specific product and try to market it as a solution. But project-based companies create a solution based on many products and sell it as a packaged solution to a particular need or problem.

Explanation:

hope this helps

8 0
3 years ago
<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="225547404f435156475062404e434c4947560c414d4f">[email&#1
Basile [38]
The answer would be D. An email address
3 0
4 years ago
Read 2 more answers
Hw to gain more knowledge ​
LenaWriter [7]

Answer:

Read Books, Search the Internet, etc...

Explanation:

6 0
3 years ago
How to see where files get ripped to windows?
Artist 52 [7]
File Explorer

AKA: Where to find files
6 0
4 years ago
Then create a new Java application called "StringSlicer" (without the quotation marks) that uses methods to:
anyanavicka [17]

Answer:

See the explanation section

Explanation:

import java.util.*;

//The above statement is to import the Scanner and ArrayList class

public class StringSlicer {

   public static void main(String args[]) {

   Scanner scan = new Scanner(System.in);

   System.out.println("Enter your string: ");

   String inputString = scan.nextLine();

   

   ArrayList<Character> stringList = new ArrayList<Character>();

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

           stringList.add(inputString.charAt(i));

       }

       

   for(Character letter: stringList){

           System.out.println(letter);

       }

   }

}

5 0
4 years ago
Other questions:
  • In which of the following stages of the development process is a team MOST likely to interview a potential user of an app?
    6·1 answer
  • Which of these computers was marketed as a computer/game machine?
    15·2 answers
  • In the accompanying figure, the split double arrow mouse pointer____.
    7·1 answer
  • Suppose a classmate constructed an electric motor with a solid commutator.that is, the commutator has no split. This solid commu
    9·1 answer
  • The following code in a different program is not working properly.The message should display the value of the intCounter variabl
    11·1 answer
  • Create a program that receives the age of a user and determine whether he/she can vote or not. Assume the voting age to be 20. C
    14·1 answer
  • Jason has decided to use his name on all the images to protect them from misuse. He has also decided to use the logo of his comp
    15·2 answers
  • Match each code snippet to its appropriate markup language name. XML CSS HTML XHTML<br><br><br>​
    10·1 answer
  • Identify the places in the code where there are object-oriented concept violations, content coupling, common coupling, control c
    8·1 answer
  • Lists Five Examples of simple statement<br>​
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!