C++-how to calculate commission and total commission from Sales?
-
The sales manager at Tompkins Company wants a program that calculates and displays each salesperson's commission, which is 10% of his or her sales. It also should display the total commission. Use a value-returning function to get the amount sold by a salesperson. The amount sold may contain a decimal place. Also use three void functions: one to calculate the 10% commission, another to display the commission, and another to calculate the total commission. The program should display the commission and total commission in fixed-point notation with two decimal places. Display the total commission only after the sales manager has finished entering the sales amounts. Use a sentinel value to end the program. #include <iostream> #include <iomanip> using namespace std; void calcCommission(double &sales); void calcTotCommission(double saleFig, double &totCom); void displayCommission(double commission, double totCommission); int main() { const double UNIT_CHG = .1; double sales = 0.0; double commission; double total = 0.0; cout << fixed << setprecision(2); calcCommission(sales); total = calcTotCommission(sales, UNIT_CHG, total); displayCommission(commission, total); system("pause"); return 0; } void calcCommission(double &sales) { cout << "Sales: "; cin >> sales; } void calcTotCommission(double saleFig, double &totCom) { totCom = saleFig * .10; } void displayCommission(double commission, double totCommission) { cout << "Commission: $" << commission << endl; cout << "Total Commission: $" << totCommission << endl; } I am confused so if anyone would help me out would be greatly appropriated.
-
Answer:
I can tell you this much, You don't even have your value returning function coded. It also say use a sentinel value to end the program which is a hint for you need a loop. Inside that loop, preferable a Do While Loop you should be the call for the value returning function for to get the amount sold be an employee, the call for the void function that will give you the commission and the call for the void function that will display the commission. Outside the loop you will need to put the call for the void function that will display the total commission so it will display after you use your sentinel value to end the loop.
John at Yahoo! Answers Visit the source
Other answers
I can tell you this much, You don't even have your value returning function coded. It also say use a sentinel value to end the program which is a hint for you need a loop. Inside that loop, preferable a Do While Loop you should be the call for the value returning function for to get the amount sold be an employee, the call for the void function that will give you the commission and the call for the void function that will display the commission. Outside the loop you will need to put the call for the void function that will display the total commission so it will display after you use your sentinel value to end the loop.
DeMarko W
Related Q & A:
- How To Calculate My Website Value?Best solution by siteprice.org
- How to calculate total distance traveled?Best solution by Stack Overflow
- How many months and how much is the overall total of my contribution to SSS?Best solution by Yahoo! Answers
- How much is Avenged Sevenfold total net worth?Best solution by networthportal.com
- How to calculate the sales revenue?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.