Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

. Five students at a local middle school volunteered to sell fresh baked cookies

ID: 3735629 • Letter: #

Question

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

Explanation / Answer

#include<iostream>

int main()

{

int StudentID;

double BoxesSold;

double Calculate;

double sum1= 4.50;

       count<<"Enter the student number (1-5) (0 to Stop): ";

       cin>> StudentID;

       count<<"Enter boxes sold: ";

       cin>> BoxesSold;

while (StudentID != 0 ){

switch (BoxesSold)

{

       case 1:

       sum1+=(4.50* BoxesSold *Calculate);

       count<<"The sales for this student 1 is $ "<<sum1<<endl;

       break;

       case 2:

       sum2=(4.50* BoxesSold *Calculate);

       count<<"The sales for this student 2 is $ "<<sum2<<endl;

       break;

       case 3:

       sum3+=(4.50* BoxesSold *Calculate);

       count<<"The sales for this student 3 is $ "<<sum3<<endl;

       break;

       case 4:

       sum4+=(4.50* BoxesSold *Calculate);

       count<<"The sales for this student 4 is $ "<<sum4<<endl;

       break;

       case 5:

       sum5+=(6.87* BoxesSold *Calculate);

       count<<"The sales for this student 5 is $ "<<sum5<<endl;

       break;

       default:

       count << "Invalid StudentId code: " << StudentId

       << " Quantity: " << BoxesSold << ' ';

       break;

}

  count<<" Enter the Student number (1-5) (0 to Stop): ";

cin>>StudentId;

count<<"Enter boxes sold: ";

cin>>BoxesSold;

}

  count<<"Total Boxes"<<endl;

count<<" Student 1 $ "<<sum1<<endl;

count<<" Student 2 $ "<<+sum2<<endl;

count<<" Student 3 $ "<<sum3<<endl;

count<<" Student 4 $ "<<sum4<<endl;

count<<" Student 5 $ "<<sum5<<endl;