1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
navik [9.2K]
3 years ago
5

C program for the sales department of a small company. The department has 4 sales person and is selling 5 products. The program

will allow the input of each sale made (sales person, product, sales amount). The program will also allow a user to see the sales made by a particular salesperson or the sales on a particular product
Computers and Technology
1 answer:
igomit [66]3 years ago
5 0

Answer:

See Explaination

Explanation:

#include<iostream>

using namespace std;

//function to enter sales

void Enter_sale(int sales[5][4])

{

//variables

int product,person,sale_amount;

cout<<"1. Product 1 \n2. Product 2 \n3. Product 3 \n4. Product 4 \n5. Product 5 \n";

//prompt for product

cout<<"Enter Product: ";

cin>>product;

cout<<"1. Sales Person 1 \n2. Sales Person 2 \n3. Sales Person 3 \n4. Sales Person 4 \n";

//prompt for sales

cout<<"Enter Sales Person: ";

cin>>person;

//prompt for sales amount

cout<<"Enter Sales Amount: ";

cin>>sale_amount;

//adding to previous total sales amount

sales[product-1][person-1]=sales[product-1][person-1]+sale_amount;

}

//function to check sales by a person

void Check_salesperson(int sales[5][4])

{

int person,total=0;

cout<<"1. Sales Person 1 \n2. Sales Person 2 \n3. Sales Person 3 \n4. Sales Person 4 \n";

//prompt for person

cout<<"Enter Sales Person: ";

cin>>person;

if(person>=1 && person<=4)

{

//printing details of sales by a person

cout<<"Details of Sales \n";

for(int i=0;i<5;i++)

{

cout<<"Product "<<i+1<<": "<<sales[i][person-1]<<"\n";

total=total+sales[i][person-1];

}

//printing total sales by a person

cout<<"Total: "<<total<<"\n";

}

else

{

cout<<"Error!\n";

}

}

//function to check sales by a product

void Check_product(int sales[5][4])

{

int product,total=0;

cout<<"1. Product 1 \n2. Product 2 \n3. Product 3 \n4. Product 4 \n5. Product 5 \n";

//prompt for product

cout<<"Enter Product: ";

cin>>product;

if(product>=1 && product<=5)

{

//printing details of sales on a product

cout<<"Details of Sales \n";

for(int i=0;i<4;i++)

{

cout<<"Sales Person "<<i+1<<": "<<sales[product-1][i]<<"\n";

total=total+sales[product-1][i];

}

//printing total sales on a product

cout<<"Total: "<<total<<"\n";

}

else

{

cout<<"Error!\n";

}

}

int main()

{

int choice;

int sales[5][4] = {{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}};

while(true)

{

//Menu

cout<<"1. Enter Sales\n2. Check Sales by a Person\n3. Check Sales on a Product\n4. Exit\n";

//choice

cin>>choice;

switch(choice)

{

//if enter sales

case 1:

Enter_sale(sales);

break;

//if check sales by a person

case 2:

Check_salesperson(sales);

break;

//if check sales on a product

case 3:

Check_product(sales);

break;

//if exit

case 4:

exit(0);

//if wrong choice

default:

cout<<"Error!\n";

break;

}

}

}

You might be interested in
The letters a, e, i, o and u are the only vowels. Write a function named vowelUseDict() takes a string t as a parameter and comp
Andru [333]

Please specify the programming language.


3 0
3 years ago
The following code will create a zombie child process because the child process is terminated and the parent process is busy in
Georgia [21]

Answer:

what on earth

Explanation:

5 0
3 years ago
What is a characteristic of an open software license
Darya [45]

Answer: Something people can change and share. It is usually given the bad name of have a bunch of fake information and bugs. Wikipedia is a good example of an open source website but it is not a program.

Explanation: An open source program is a program where you have free rein to basically do whatever you want to it.

3 0
3 years ago
Which port security violation mode does not generate messages or increment the violations counter?
Zanzabum

The number of violations is increased. When a secure port is in the error-disabled condition, the shutdown and restrict command can be used to restore it.

<h3>What is  offence?</h3>

A deviation from a code of conduct or law is referred to as a violation. When driving a car, going over the posted speed limit is a regular legal violation. Invading someone else's privacy could include reading their journal. failure to uphold a duty or right; breaching the law.

The two types of violations are states and acts. A transgression is a violation of the rules that is less serious than a foul and frequently involves technicalities of the game. A disrespectful or vulgar act: profanation.

Hence, The number of violations is increased. When a secure port is in the error-disabled condition, the shutdown and restrict command can be used to restore it.

To learn more about violation, refer to:

brainly.com/question/1274113

#SPJ4

4 0
2 years ago
In 5-10 sentences, describe the purposes, design considerations, and common elements of most brochures.
lozanna [386]
The primary thing to consider when designing a brochure is the target audience. <span> Brochures are meant to capture attention and deliver information, so it's important that the audience will want to read it in the first place.</span> When planning the design, consider the placement of elements and how they are arranged, or the 'white space'. Also take into consideration whether photos will be used. This ensures readability. <span>Also plan for the brochure's color scheme and fonts. These capture the audience so these are core parts of the design.</span>
4 0
3 years ago
Other questions:
  • Create a function that will perform linear interpolation from a set of measured data stored in a list or array. The function sho
    13·1 answer
  • A network technician is assisting the security team with some traffic captures. The security team wants to capture all traffic o
    9·1 answer
  • 3-Write a program in some language that has both static and stack dynamic local variables in subprograms. Create six large (at l
    9·2 answers
  • While designing your network's VLAN topology, your team has decided to use a centrally managed DHCP server rather than creating
    8·1 answer
  • How can an Excel table be added to a Word document? Check all that apply.
    15·1 answer
  • Lisa is modifying a spreadsheet. Which view will allow Lisa to see how her changes will look when she prints the spreadsheet?
    13·2 answers
  • Find products that satisfy BOTH conditions below:______
    6·1 answer
  • Determine whether the phrase below is a sentence or a fragment.
    12·1 answer
  • Define input hardware​
    12·1 answer
  • try the following code to see a nullpointer error (if you don’t see the error because of the autograding, you can copy it into t
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!