Question

In: Computer Science

Please create a c++ program that will ask a high school group that is made of...

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)

Solutions

Expert Solution

Code

#include<iostream>
using namespace std;

int main()
{
    cout << "Enter number of students participated in sales drive(5-7): ";
    int n; //number of students
    cin>>n;
    string stu[n]; //array to store student names
    int tot=0;
    int s=0,l=0,p=0;
    int ep[n]; //profit of each student
    int sb[n],lb[n]; //array of small amd  large boxes
    for(int i=0;i<n;i++)
    {
        cout<<"Enter first name of the student "<<(i+1)<<":";
        cin>>stu[i];
        cout<<"Enter number of small boxes sold by "<<stu[i]<<":";;
        cin>>s;
        p=p+(s*3); //buy 4 sell 7 profit 3
        cout<<"Enter number of large boxes sold by "<<stu[i]<<":";
        cin>>l;
        p=p+(l*7); //buy 6 sell 13 profit 7
        ep[i]=p;
        sb[i]=s;
        lb[i]=l;
        tot=tot+p;
        p=0;
    }
    for(int i=0;i<n;i++)
    {
        cout<<stu[i]<<" sold "<<sb[i]<<" small boxes and "<<lb[i]<<" large boxes and made profit of $"<<ep[i]<<"\n";
    }
    cout<<"Total profit that group made is "<<tot;
    return 0;
}

Terminal Work

.


Related Solutions

Please create a C++ program that will ask a high school group that is made of...
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...
Please create a C++ program that will ask a high school group that is made of...
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...
Q1) Please create a C++ program that will ask the user for how many test scores...
Q1) Please create a C++ program that will ask the user for how many test scores will be entered. Setup a while loop with this loop iteration parameter. The data will include the student’s first name, Wayne State Access ID, midterm score and their favorite team (i.e. – Doug, hg1702, 92, Wolverines * - John, hv2201, 99, Warriors). Print out the completed test scores to a file (midTermScores.txt) . Adjust the output as follows: (15 points) a. Scores with the...
Create a C++ program that will ask the user for how many test scores will be...
Create a C++ program that will ask the user for how many test scores will be entered. Setup a while loop with this loop iteration parameter. (no fstream) The data needs to include the student’s first name, student number test score the fields should be displayed with a total width of 15. The prompt should be printed with a header in the file explaining what each is: ex. First Name student number Test Score 1) mike 6456464   98 2) phill...
C++ polymorphism. Create a program that issues a quiz through the terminal. The quiz will ask...
C++ polymorphism. Create a program that issues a quiz through the terminal. The quiz will ask a variety of C++ questions to the user and prompt them for a response. The response will differ based on the type of question, such as true or false, multiple-choice, or fill in the blank. Part 1: Designing the Quiz Design this program using a polymorphic vector of questions. Create a Question base class that will serve to point to three different derived classes:...
Using (C programming language) Create a health monitoring program, that will ask user for their name,...
Using (C programming language) Create a health monitoring program, that will ask user for their name, age, gender, weight, height and other health related questions like blood pressure and etc. Based on the provided information, program will tell user BMI, blood pressure numbers if they fall in healthy range or not and etc. Suggestions can be made as what should be calorie intake per day and the amount of exercise based on user input data. User should be able to...
C++ Create a program that simulates a coin being flipped. Ask the user to guess between...
C++ Create a program that simulates a coin being flipped. Ask the user to guess between heads and tails. Let the user input 0 for heads and 1 for tails. Use a random generator to get random guesses every time. If the user guesses correctly, give them 1pt. Use a counter and initialize it to 0.   If the user does not guess correctly, subtract a point. Create a menu that allows the user to continue guessing, view the current score...
Please use C language and use link list to do this program. This program should ask...
Please use C language and use link list to do this program. This program should ask user to enter two fraction polynomials. Then user chocie if he want add it or multiple it. I need you please to test it to see if it work with these two fraction polynomials 1-  Left Poly Pointer: 1/1x2 + 3/4x + 5/12 2-Right Poly Pointer: 1/1x4 – 3/7x2 + 4/9x + 2/11 AND AFTER ADDING 3- Resulting Poly Pointer: 1/1x4 + 4/7x2 + 43/36x...
In visual Studio C++ Create a program that uses a for loop to input the high...
In visual Studio C++ Create a program that uses a for loop to input the high temperature, and low temperature for each day of the week. The high and low will be placed into two elements of the array. For each loop the high and low will be placed into the next set of elements of the array. After the temps for all seven days have been entered into the array, a for loop will be used to pull out...
Create a small program that contains the following. ask the user to input their name ask...
Create a small program that contains the following. ask the user to input their name ask the user to input three numbers check if their first number is between their second and third numbers
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT