COS1511/102/1/2018 Question 3: The Golden Sales Company pays it salespeople R12.
ID: 3705685 • Letter: C
Question
COS1511/102/1/2018 Question 3: The Golden Sales Company pays it salespeople R12.50 for each item they sell. Given the number of tems sold by a salesperson, your program should first print a heading, then calculate, and print the amount of pay due A function named printHeading (with no parameters) displays the following message GOLDEN SALES COMPANY This program inputs the number of items sold by a Salesperson and prints the amount of pay due Another function, calculatePay displays the amount pay due to a salesperson. The function multiples the numer of items sold with 12.50 to compute the pay to be payed out. The function has one value parameter items representing the number of items sold by a salesperson. A main program inputs an integer value (items). It displays the description of the program by calling the function printHeading. The program then calls the function calculatePay to calculate and display the amount of pay due. Sample run: GOLDEN SALES COMPANY This program inputs the number of items sold bya Salesperson and prints the amount of pay due Please input the number of items sold 125 The amount pay due is R 1562.50Explanation / Answer
Hi, there this question have three simple part.
one need to print the Console Header, and the next to input the number of items sole by salesman ,and the last to prints the amount due.
And one thing keep in mind that thi sprogram should be written inside the while(1) loop. so that it can run infinitaly, intill a special character(some designated character) been not entered.
now let's start moving to write the programs:
firstlet me write the main program:
int main()
{
int n_sold;
printf ("*****************************************************
This program is the number of items sold by a
Salesperson and prints the amount of pay due
***************************************************** ");
printf("Plese input the number of items sold");
n_sold = input();
printf(" The amount pay dur is R %f", calculate_Pay(n_sold));
reuturn 0;
}
Now lets move for the helping function:
float calcumlatePay(int n_sold)
{
reutrn n_sold*12.5;
}
smilimar for input, you can simple write the :
scanf("%d", &n_sold);
Thanks.