Question: Please write this program in C + + . Today, we will be writing a program to read in the number of pieces of candy
Please write this program in C Today, we will be writing a program to read in the number of pieces of candy that a group of children collects on Halloween night and estimating the weight of each child's bag of candy.
Write a program that will do the following:
Create two arrays of datatype double named Pieces and Weight with elements each.
Create a variable of datatype int name numelements and set the value at Use numelements in each of the loops below.
In a loopyou can use either a for loop or a while loop, your choice prompt the user to enter values for Pieces ie how many pieces of candy did each child collect
In a separate loop, convert the Pieces of each of the values entered by the user and store the converted value in Weight. In that same loop, print a table with columns that will include the "Number of Pieces" and "Candy Weight"to decimal places Use this formula to convert the number of Pieces to Weight NOTE: you will need to print the labels for each column of the table outside this second loop:
Weightin pounds No of Pieces
In a third loop, sum the values of Weight. Once that loop is over, print the total weight of the candy to the screen to decimal places.
Use the following values for Pieces to test your program:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
