Computers and Technology
23.03.2023 21:56
106
462
8
Solved by an expert

Assume an int array, candy, stores the number of candy bars sold by a group of children

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
Show Answers
markusovaevelyn532
markusovaevelyn532
4,6(65 marks)

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

shanice13
shanice13
4,8(88 marks)

a program execution is called a process

Explanation

In the process, they process the data and also execute the data.

What happen in process?

First the data came from input, then go to the memory. The process take the data from the memory and process it and divide it, if there's arithmetic data thingy it will go to ALU and the rest to CU. After the data finish being proceed, the data will be sent to CU and executed there, then send back to the memory and go to the output to be shown.

#Sorry my grammar sucks

#Moderators please don't be mean, dont delete my answers just to get approval from your senior or just to get the biggest moderation daily rank.

Popular Questions about the subject: Computers and Technology

Apassive threat seeks out vulnerable targets.truefalse...
Computers and Technology
17.04.2022 06:35
Which of the following instances best incopporates the use of software on your...
Computers and Technology
30.10.2020 11:09
Aweb page document is contained between opening and closing ....
Computers and Technology
27.04.2022 15:21
Media refers to digital media that involve user interaction for education, training,...
Computers and Technology
03.09.2020 14:29
Vehicle license plates and registrations must be renewed...
Computers and Technology
31.10.2022 09:59
Amotorboat is crossing paths with a pwc. what action should be taken? a. the motorboat...
Computers and Technology
26.03.2020 04:58
Abigail is writing an email to justine swenson, a friend of her best friend, jane,...
Computers and Technology
02.11.2022 02:38
Aparagraph places the first character of a text line near the left border of a...
Computers and Technology
25.02.2023 03:34
Why are networked systems beneficial? many peripherals can be used passwords are...
Computers and Technology
31.05.2021 16:04
The process of using or controlling two or more windows at a time is known as....
Computers and Technology
14.03.2022 03:50

New questions by subject

What is the name of the poem on the base of the Statue of Liberty? A. The New Colossus...
History
22.04.2021 20:20
GO16_XL_CH02_GRADER_2E_HW - Plants 1.2 Project Description: In the following project,...
Computers and Technology
06.11.2021 08:53
Ayúdenme porfa :c ..........
Mathematics
18.07.2020 13:21
Why is it important to protest for the civil rights?...
English
21.02.2022 00:26
I’m lost someone help....
History
11.04.2023 01:43
What is answer i need it...
Mathematics
22.01.2023 06:27
A Long Walk to Water Chapter 9...
English
20.10.2022 23:40
#
#
#
#
# #

We expand our knowledge with many expert answers