subject

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 bars 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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
The animal classthis class represents a an animal residing at a zoo. it has a weight (in pounds),height (in inches), a name, and a color. the methods in the class include constructors,getters, and a tostring. you will finish the implementation of these methods. referto the code documentation.1.getters: you will need to implement getter methods. these get a value (froma member variable) in the animal class. you will make a getter method toreturn each variable (weight, height, name, color). reference getname if youare having issues.2.tostring: you will need to finish the tostring method. this returns a stringcontaining information about an animal. the output string should be of theformat: ” (name) , a ( color )â’colored animal . ( weight ) pounds , ( height ) inches .\n”the height and weight are formatted to 1 decimal place. recall from lab 1how to format strings neatly using string. see the reference sectionfor more about string.format.
Answers: 2
question
Computers and Technology, 22.06.2019 00:10
How does access indicates that a filter has been applied to a specific column
Answers: 1
question
Computers and Technology, 22.06.2019 01:20
What is the full meaning of rfid in computer
Answers: 2
question
Computers and Technology, 23.06.2019 04:31
Selling a product through an electronic medium is
Answers: 1
You know the right answer?
Assume an int array, candy, stores the number of candy bars sold by a group of children where candy[...
Questions
Questions on the website: 13722367