Question

A company of 20 employees wants to find the employee who made the highest commission so...

A company of 20 employees wants to find the employee who made the highest commission so he/she can be paid a 10% bonus of the commission he/she earned for that month.

The commission an employee makes is calculated by multiplying the sales amount by the commission rate. The commission rates are shown below:

Sales Amount Commission
Less Than 40000 No commission
40000 to 80000 inclusive 5%
Greater than 80000 10%


Write a program to:

  • Prompt the user for each employee’s id (an integer value) and the sales amount
  • For each employee, display the commission earned
  • Display the total commission earned by all the employees
  • Display the average commission earned by an employee
  • Display the employee id, the commission and the bonus paid to the employee with the highest commission

WRITTEN IN C++, ONLY IOSTREAM LIBRARY TO BE USED, NO ARRAYS TO BE USED

Homework Answers

Answer #1

#include <iostream>
using namespace std;
int main()
{
int id,hId;
double sales,amount=0,commission=0,total=0,highestC=-1;;
for(int i=0;i<20;i++)
{
cout<<"Enter employee id of employee "<<(i+1)<<" : ";
cin>>id;
cout<<"Enter sales amount of employee "<<(i+1)<<" : ";
cin>>sales;
if(sales<40000)
{
commission=0;
}
else if(sales>=40000&&sales<=80000)
{
commission=0.05*sales;
}
else
{
commission=0.1*sales;
}
cout<<"Commission = "<<commission<<endl;
total=total+commission;
if(commission>highestC)
{
highestC=commission;
hId=id;
}
}
cout<<"Total commission earned by all employees = "<<total<<endl;
cout<<"Average commission earned by an employee = "<<(total/20.0)<<endl;
cout<<"Employee with the highest commission:\tEmployeeId = "<<hId<<"\tCommission = "<<highestC<<"\tBonus = "<<(0.01*highestC);
return 0;
}


Know the answer?
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
Similar Questions
Java Programming COMP-228 LAB ASSIGNMENT #1 >> Apply the naming conventions for variables, methods, classes, and...
Java Programming COMP-228 LAB ASSIGNMENT #1 >> Apply the naming conventions for variables, methods, classes, and packages: - variable names start with a lowercase character for the first word and uppercase for every other word - classes start with an uppercase character of every word - packages use only lowercase characters - methods start with a lowercase character for the first word and uppercase for every other word Java Programming COMP-228 Exercise #1: [5 marks] Write a Java application using...
Use a few sentences to describe the problem given below . Also, Identify the nouns and...
Use a few sentences to describe the problem given below . Also, Identify the nouns and verbs used in the below project descriptions.  Identified nouns, list the ones that are necessary to define variables in your program. For each variable, specify its name, data type, and what information it is used to store. Write the pseudo code algorithm (i.e. algorithm steps) to solve this problem. (For the base salaries and commission rates use constants instead to keep these values. Use the...
Using C# Create an Employee class with five fields: first name, last name, workID, yearStartedWked, and...
Using C# Create an Employee class with five fields: first name, last name, workID, yearStartedWked, and initSalary. It includes constructor(s) and properties to initialize values for all fields. Create an interface, SalaryCalculate, class that includes two functions: first,CalcYearWorked() function, it takes one parameter (currentyear) and calculates the number of year the worker has been working. The second function, CalcCurSalary() function that calculates the current year salary. Create a Worker classes that is derived from Employee and SalaryCalculate class. In Worker...
Case Study: Henderson Printing is a small- to medium-sized manufacturer of account books, ledgers, and various...
Case Study: Henderson Printing is a small- to medium-sized manufacturer of account books, ledgers, and various types of record books used in business. Located in Halifax, the company has annual sales of about $12 million, mostly in the Atlantic provinces. The owner, George Henderson, is a firm believer in making a high-quality product that will stand up to many years of use. He uses only high-grade paper, cover stock, and binding materials. Of course, this has led to high production...
Question 1 of 15 Linsay’s Landscaping wants to make notes in QuickBooks each time she services...
Question 1 of 15 Linsay’s Landscaping wants to make notes in QuickBooks each time she services a client to streamline the invoicing process at the end of the month. She does not want these records to affect any month or year to date financial reports throughout the month until she invoices the client. Which of the following transaction types do you recommend she uses to achieve this goal? A. Invoice B. Credit Memo C. Sales Receipt D. Delayed Charge E....
2. SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to...
2. SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to be used as a basis for class discussion rather than as an illustration of the effective or ineffective handling of an administrative situation. The name of the company is disguised. INTRODUCTION In light of demographic concerns, in 2012, the Japanese government initiated an effort to change the work environment in order to secure the workforce of the future. Japan is world renowned for its...
3 SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to...
3 SECURING THE WORKFORCE Diversity management in X-tech, a Japanese organisation This case is intended to be used as a basis for class discussion rather than as an illustration of the effective or ineffective handling of an administrative situation. The name of the company is disguised. INTRODUCTION In light of demographic concerns, in 2012, the Japanese government initiated an effort to change the work environment in order to secure the workforce of the future. Japan is world renowned for its...
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation....
Using the model proposed by Lafley and Charan, analyze how Apigee was able to drive innovation. case:    W17400 APIGEE: PEOPLE MANAGEMENT PRACTICES AND THE CHALLENGE OF GROWTH Ranjeet Nambudiri, S. Ramnarayan, and Catherine Xavier wrote this case solely to provide material for class discussion. The authors do not intend to illustrate either effective or ineffective handling of a managerial situation. The authors may have disguised certain names and other identifying information to protect confidentiality. This publication may not be...
Johnson Company— Internal Controls Johnson Company Inc. (Johnson Company or the “Company”) is a U.S. public...
Johnson Company— Internal Controls Johnson Company Inc. (Johnson Company or the “Company”) is a U.S. public company that files quarterly and annual reports with the Securities and Exchange Commission (SEC). JOHNSON COMPANY is a leading retail chain operating more than 500 department stores across the continental United States. JOHNSON COMPANY department stores offer customers a variety of nationally advertised products, including cookware, shoes, jewelry, perfume, and other accessories. The Company’s supply chain of products is managed through a single warehouse...
Background ABC Retailers Inc. (ABC or the “Company”) is a U.S. public company that files quarterly...
Background ABC Retailers Inc. (ABC or the “Company”) is a U.S. public company that files quarterly and annual reports with the Securities and Exchange Commission (SEC). ABC is a leading retail chain operating more than 100 department stores across the continental United States. ABC department stores offer customers a variety of nationally advertised products, including clothing, shoes, jewelry, and other accessories. The Company’s supply chain of products is managed through a single warehouse and distribution facility located in Kansas City,...