In: Computer Science
Please create a C++ program that will ask a high school group that is made of 5 to 17 students to sell candies for a fund raiser. There are small boxes that sell for $7 and large ones that sell for $13. The cost for each box is $4 (small box) and $6 (large box). Please ask the instructor how many students ended up participating in the sales drive (must be between 5 and 17). The instructor must input each student’s First name that sold items and enter the number of each box sold each (small or large). Calculate the total profit for each student and at the end of the program, print how many students participated and the total boxes sold for each (small and large) and finally generate how much profit the group made. (15 points)
#include <iostream>
using namespace std;
int main()
{
int n;
string stud_name[17];
int small_box[17], big_box[17];
cout << "Enter the number of students took part in fund raising: ";
cin >> n;
for (int i=0; i<n; i++)
{
cout << "\n";
cout << "Enter " << (i+1) <<" number student name: ";
cin >> stud_name[i];
cout << "Number of small box sold: ";
cin >> small_box[i];
cout << "Number of big box sold: ";
cin >> big_box[i];
}
int tot_small_box = 0, tot_big_box = 0, tot_sale = 0;
for(int i=0; i<n;i++)
{
cout << "\n";
int individual_sale = ((small_box[i])+(big_box[i]));
cout << "\nStudent name: " << stud_name[i] << "\nSmall box sold: " << small_box[i] << "\nBig box sold: " << big_box[i] << "\nStudent's individual sale: " << individual_sale << " boxes";
cout<< "\nStudent's individual profit: " << (small_box[i]*2 + big_box[i]*6);
tot_small_box += small_box[i];
tot_big_box += big_box[i];
}
cout << "\n\n\n";
cout << "\nNumber of students participated: " << n;
cout << "\nTotal small boxes sold by the group was " << tot_small_box;
cout << "\nTotal big boxes sold by the group was " << tot_big_box;
cout << "\nTotal profit generated by the group was " << (tot_small_box*2 +tot_big_box*6);
return 0;
}