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...
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...
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
In c++ create a program that asks for tire shop sales numbers made by 0 to...
In c++ create a program that asks for tire shop sales numbers made by 0 to 20 employees Premium tires sell for $300 and standard tires sell for $250 The wholesale cost of premium tires is $120 and the standard is $100 The program must ask for each employee's name and then the amount of premium and standard tires sold. Output the name and the total profit each employee made for the shop Output the total profits earned between all...
Write C++ program to do the following: 1. Create integer array size of 10 2. Ask...
Write C++ program to do the following: 1. Create integer array size of 10 2. Ask user input the values of the array's element using for loop 3. pass the array to void function. in void function do the following: a. Find the maximum of the array. b. Compute the element average c. Find out how many numbers are above the average d. Find out and print how many numbers are below the average e. find out how many numbers...
Sandy is a school nurse who is going to a high school to educate a group...
Sandy is a school nurse who is going to a high school to educate a group of juniors and seniors on HIV today. Included in her seminar for this group of high school students, she will discuss the following: a. How is HIV transmitted? b. How to prevent the spread to others? c. What is HIV? 2. Sandy has completed her seminar, and it is question and answer time. A senior asks Sandy about AIDS vaccines. a. Discuss what you...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT