Question

Write a C program that allows the user to enter sales information for a number of...

Write a C program that allows the user to enter sales information for a number of sales persons and compute the commissions due for each, and summary results in report form. The program should first prompt the user to enter how many sales persons to include in the analysis. The user will then be prompted for the name, number of sales commissions, and rate of commission to be paid to each sales person. A summary itemized report will follow, see sample I-O below. The dialog with the user should look identical to the one below, only with your special introductory statement (for the good data supplied) Welcome to the Acme Commission Analysis Enter the number of sales persons(1-20): 3 Enter the name of sales person #1: John Enter the number of sales for John: 3 Enter the commission percentage for John: 10 Sale #1 for John: 10000 Sale #2 for John: 9000 Sale #3 for John: 12000 Enter the name of sales person #2: Mary-Jane Enter the number of sales for Mary-Jane: 3 Enter the commission percentage for Mary-Jane: 12 Sale #1 for Mary-Jane: 14000 Sale #2 for Mary-Jane: 95000 Sale #3 for Mary-Jane: 22000 Enter the name of sales person #3: George Enter the number of sales for George: 2 Enter the commission percentage for George: 9 Sale #1 for George: 10000 Sale #2 for George: 9000 *** Sales Commission Report *** Name Sales Commission ------- ------ ---------------- John 31000.00 3100.00 Mary-Jane 131000.00 15720.00 George 19000.00 1710.00 Totals: 181000.00 20530.00

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Program

#include <stdio.h>
#include <stdlib.h>


struct Details{ //structure to store details
char name[30];
float nsales[20];
float total;
float rate;
}sale[20];

int main()
{
int numofsale,indsale,i,j;
printf("------Welcome to the Acme Commission Analysis------\n Enter the number of sales persons(1-20):");
scanf("%d",&numofsale);
  
for(i=0;i<numofsale;i++)
{
sale[i].total=0;
sale[i].rate=0;
printf("\nEnter the name of sales person #%d :",i+1);
scanf("%s",&sale[i].name);
printf("\nEnter the number of sales for %s :",sale[i].name);
scanf("%d",&indsale);
printf("Enter the commission percentage for %s :",sale[i].name);
scanf("%f",&sale[i].rate);

for(j=0;j<indsale;j++)
{
printf("Sale #%d for %s :",j+1,sale[i].name);
scanf("%f",&sale[i].nsales[j]);
sale[i].total+=sale[i].nsales[j];
}
  
  
}
float gtotal=0;
float gcommission=0;
printf("\n*** Sales Commission Report ***\n");
printf("Name Sales Commission\n");
for(i=0;i<numofsale;i++)
{
float temp=sale[i].total*sale[i].rate;

printf("%s %0.2f %0.2f\n",sale[i].name,sale[i].total,temp/100);

gtotal+=sale[i].total;
  
gcommission+=temp/100;
  
}
printf("Totals: %f %f",gtotal,gcommission);
  
return 0;
}

Output

If you find this useful , please rate positive , thankyou

Add a comment
Know the answer?
Add Answer to:
Write a C program that allows the user to enter sales information for a number of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C program that allows a user to enter up to 30 student id’s and...

    Write a C program that allows a user to enter up to 30 student id’s and 3 grades per student. It will then compute and display a report of the students averages, and then a statement of the class average for those grades. The following is a sample run that demonstrates what your program should look like: Please enter your school name: Cape Tech Welcome to the Cape Tech Grade Calculator Enter the number of students to process (0 -...

  • Assignment: Write a program that asks the user to enter today’s sales for five stores. The...

    Assignment: Write a program that asks the user to enter today’s sales for five stores. The program should then display a bar chart comparing each store’s sales. Create each bar in the bar chart bydisplaying a row or asterisks. Each asterisk should represent $100 of sales. You must use a loop to print the bar chart. If the user enters a negative value for the sales amount, the program will keep asking the user to enter the sales amount until...

  • (Write a program for C++ )that allows the user to enter the last names of five...

    (Write a program for C++ )that allows the user to enter the last names of five candidates in a local election and the number of votes received by each candidate. The program should then output each candidate’s name, the number of votes received, and the percentage of the total votes received by the candidate. Your program should also output the winner of the election. A sample output is: Candidate    Votes Received    % of Total Votes Johnson            5000               25.91...

  • Write a C++ program that asks the user to enter first lettters of the names of...

    Write a C++ program that asks the user to enter first lettters of the names of his two favourite persons. The program should print which persons name comes first alphabetically.

  • This program will ask the user to enter a number of players, then ask the user...

    This program will ask the user to enter a number of players, then ask the user for each player's name and score. Once all of the players have been entered, the program will display a bar chart with each of their scores scaled as a percentage of the maximum score entered. See below for details on exactly how this should work - an example transcript of how the program should work is shown below (remember that values entered by the...

  • Write a program that allows the user to enter a series of exam scores. The number...

    Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate. You need to use a while loop...

  • In C++ 2. Write a program that allows the user to enter a series of positive...

    In C++ 2. Write a program that allows the user to enter a series of positive numbers between 1 and 100 and displays the smallest and largest of the numbers entered. The program should not store the numbers that were entered, only keep track of the smallest and largest ones. The program should continue accepting numbers until the value 0 is entered and then display the results. If a number out of range is entered, tell the user it is...

  • 14.3: More Sentences Write a program that allows a user to enter a sentence and then...

    14.3: More Sentences Write a program that allows a user to enter a sentence and then the position of two characters in the sentence. The program should then report whether the two characters are identical or different. When the two characters are identical, the program should display the message: <char> and <char> are identical! Note that <char> should be replaced with the characters from the String. See example output below for more information. When the two characters are different, the...

  • 2) Write a program in C/C++ that asks the user to enter a number then the...

    2) Write a program in C/C++ that asks the user to enter a number then the user's input value is passed to a function which increments the number by 10 and returns the result of the incrementation. Write the program to accomplish the increment using three (3) different techniques. To test each technique separately, the user should enter a different number for each of the three (3) techniques. Make sure that you compile and execute your program. Finally, provide screenshots...

  • Write a program that allows the user to navigate the lines of text in a file....

    Write a program that allows the user to navigate the lines of text in a file. The program should prompt the user for a filename and input the lines of text into a list. The program then enters a loop in which it prints the number of lines in the file and prompts the user for a line number. Actual line numbers range from 1 to the number of lines in the file. If the input is 0, the program...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT