Question: (NEEDED IN C++) Pt 1: Five students at a local middle school volunteered to sell fresh baked cookies to raise funds to increase the number

(NEEDED IN C++)

Pt 1: Five students at a local middle school volunteered to sell fresh baked cookies to raise funds to increase the number of computers for the computer lab. Each student reported the number of boxes he/she sold. Cost of each box of cookies was $4.50. Write a program that will output the total number of boxes of cookies sold, the total revenue generated by selling the cookies, and the average number of boxes sold by the students. Prompt the user to enter the following information: the StudentID number and the number of boxes sold.

**I have part 1 here I need parts 2 and 3 (below)**

#include using namespace std; int main() { //declare variables int SID; double BoxesSold, Total_Box = 0; //total revenue double TotalRev; //avg # of sales double AvgSold; //cost per box double cost = 4.50; //total # of students selling int counter; for (int counter = 1; counter <= 5; counter++) { //prompt user to enter SID cout << "Enter ID number for student " << counter << ": "; cin >> SID; //prompt to enter # of boxes sold by that ID number cout << "Enter number of boxes sold by " << SID << ": "; cin >> BoxesSold; //total Boxes Total_Box = Total_Box + BoxesSold; } // total revenue TotalRev = Total_Box * cost; //Avg # sold by all AvgSold = Total_Box / total; //output total revenue cout << "Total Revenue = $" << TotalRev << endl; //output Average boxes sold cout << "Average boxes sold by " << total << " students = " << AvgSold << endl; } system("pause"); }

~~~~~~~~~~~~

PT 2: In the program above you know the exact number of student volunteers. Now suppose that the programmer does not know the exact number of volunteers. Once again, assume that the data is in the following form, i.e. the students ID number and the number of boxes sold by the student is provided by the user. Prompt the user to enter this information as in Question 1, but here, you do not know the exact number of volunteers, instead -1 will mark the end of the data entered.

PT 3: Finally, redo question 2, but this time declare a Boolean variable and use it to control the while loop.

I know that I need a sentinel loop for pt 2 and a boolean loop for pt 3.

PLEAAASE HELP.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!