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 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...

  • 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...

  • In C++ 1. Write a program that allows a user to enter 10 integer values from...

    In C++ 1. Write a program that allows a user to enter 10 integer values from the keyboard. The values should be stored in an array. 2. The program should then ask the user for a number to search for in the array: The program should use a binary search to determine if the number exists in a list of values that are stored in an array (from Step #1). If the user enters a number that is in the...

  • in Python: Write a program that allows the user to enter a number between 1-5 and...

    in Python: Write a program that allows the user to enter a number between 1-5 and returns an animal fact based on what the user entered. The program should 1. Continue to run until the user enters “quit” to terminate the program, and 2. Validate the user’s input (the only acceptable input is 1, 2, 3, 4, 5 or “quit”). You can use the following animal facts: An octopus is a highly intelligent invertebrate and a master of disguise. Elephants...

  • Write a C program which asks the user to enter a name of a person and...

    Write a C program which asks the user to enter a name of a person and the program finds the number of that person. The number is displayed. Otherwise output "Not found". Your program have to check only given names. The program declares and initializes a two-dimensional array of characters that holds pairs of names and numbers. The array can hold 10 strings, each capable of holding up to 79 characters. Array elements are following: "Adam", "585-5622", "Mark", "505-8446", "Austin",...

  • In C++ Write a program that allows the user to enter eight integer values. Display the...

    In C++ Write a program that allows the user to enter eight integer values. Display the values in the reverse order of the order they were entered. Name the file ReverseNumbers.cpp.

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
ADVERTISEMENT