Question

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 if else statement and loop statement)

In the C++ code
Use COMMENT YOUR CODE and use meaningful variable names; and. Conduct the following error checking of user input: - length of employment must NOT be less than or equal to 0  - sales amount must NOT be less than or equal to 0.
Create your testing plan and follow your testing plan to thoroughly test all possible cases, which include all commission rates, lengths of employment, and employment categories. Make sure to test your error checking code. Keep all your testing data and testing results so you can submit them.


Problem question 1, Write a program to calculate the salary paid to its salespersons at Pohanka.
The salary is calculated based on a salesperson’s length of employment in years and employment category (full-time employee
or part-time employee).
The salary calculation rules are as following:
1) If an employee is a part-time employee and worked here for less than 5 years, the salary consists of only the commission amount.
                                                                                                2) If an employee is a part-time employee and worked here for more than or equal to 5 years, the salary consists of base salary of $2,500 and commission amount;
3) If an employee is a full-time employee and worked here for less than 5 years, the salary consists of base salary of $5,000 and commission amount;
4) If an employee is a full-time employee and worked here for more than or equal to 5 years, the salary consists of base salary of $10,000 and commission amount.
The commission amount is calculated using the following commission rates:
Sales Amount Commission Rate
$0 to $15,000 10%
$15,001 to $60,000 15%
Over $60,000 33%
Write the program will receive a user’s input of the number of salespersons from the keyboard. For each salesperson, your program will
1) read in the salesperson’s first name, last name, the length of employment in years, employment category, and the sale amount in dollar from the keyboard;
2) calculate the appropriate commission and salary for this salesperson; 3) display this salesperson’s first name, last name, total commission, and total salary amount in a nice format. Before    your program exits, it should display the average commission and the average salary amount for all the employees.

Homework Answers

Answer #1

#include <iostream>

using namespace std;
int main() {
  
int num_emp,totalCommision=0,totalsalary=0;
cout << "Enter number of employees"<<endl;
cin>>num_emp; //num_emp contains number of employees.
string fname[num_emp],lname[num_emp]; //contains list of first names and last names of employees.
float elength[num_emp],sale[num_emp],salary[num_emp],commision[num_emp];
char category[num_emp]; //Employement category F for full-time and P for Part-time.
  
for(int i=0;i<num_emp;i++) //for each number of employees.
{
cout<<"Enter first name ";
cin>>fname[i];
cout<<"last name ";
cin>>lname[i];
cout<<"employment length in years ";
cin>>elength[i];
if(elength[i]<0)
{
cout<<"employment length should be greater than 0."<<endl;
exit(0);
}
cout<<"employment category : Press F for full-time and P for Part-time ";
cin>>category[i];
cout<<"sale amount ";
cin>>sale[i];
if(sale[i]<0)
{
cout<<"sale should be greater than 0."<<endl;
exit(0);
}
}
  
for(int i=0;i<num_emp;i++)
{
if(sale[i]>=0 && sale[i]<=15000) // 0 < sale < 15000 : commision is 10% of sale.
commision[i]=0.1*sale[i];
else if(sale[i]>15000 && sale[i]<=60000) // 15001 < sale < 60000 : commision is 15% of sale.
commision[i]=0.15*sale[i];
else if(sale[i]>60000) // 60001 < sale : commision is 33% of sale.
commision[i]=0.33*sale[i];
  
if(category[i]=='P' && elength[i]<5) // If employee is part-time and worked for less than 5 years, then salary=commission amount.
{
salary[i]=commision[i];
}
if(category[i]=='P' && elength[i]>=5) // If employee is part-time and worked for less than 5 years, then salary=commission amount+2500.
{
salary[i]=commision[i]+2500;
}

if(category[i]=='F' && elength[i]<5) // If employee is part-time and worked for less than 5 years, then salary=commission amount+5000.
{
salary[i]=commision[i]+5000;
}
  
if(category[i]=='F' && elength[i]>=5) // If employee is part-time and worked for less than 5 years, then salary=commission amount+10000.
{
salary[i]=commision[i]+10000;
}
totalsalary+=salary[i]; //totalsalary=sum of salary of each employee.
totalCommision+=commision[i]; //totalcommision=sum of commision of each employee.
}
  
cout<<"First Name\tLast Name\tTotal Commision\tTotal salary\n"<<endl;
for(int i=0;i<num_emp;i++)
{
cout<<fname[i]<<"\t\t"<<lname[i]<<"\t\t"<<commision[i]<<"\t\t"<<salary[i]<<endl;
}
  
cout<<endl;


cout<<"Average Commision:"<<(totalCommision/num_emp)<<endl; //Showing avg. commission in the end.
cout<<"Average Salary:"<<(totalsalary/num_emp)<<endl; //Showing avg. salary in the end.
  
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
(Use Java ) please write comment on every line I need to understand the code Problem...
(Use Java ) please write comment on every line I need to understand the code Problem Description: Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the rectangle centered at (0, 0) with width 10 and height 5. For example, (2, 2) is inside the rectangle and (6, 4) is outside the rectangle, as shown in the Figure. (Hint: A point is in the rectangle if its horizontal distance...
Objectives:The focus of this assignment is to create and use a recursive method given a moderately...
Objectives:The focus of this assignment is to create and use a recursive method given a moderately difficult problem. Program Description: This project will alter the EmployeeManager to add a search feature, allowing the user to find an Employee by a substring of their name. This will be done by implementing the Rabin-Karp algorithm. A total of seven classes are required. Employee (From previous assignment) HourlyEmployee (From previous assignment) SalaryEmployee (From previous assignment) CommissionEmployee (From previous assignment) EmployeeManager (Altered from previous...
Subject: Human Resource Management Main question: Which benefit plans would you choose, and which wouldn't you...
Subject: Human Resource Management Main question: Which benefit plans would you choose, and which wouldn't you choose and give reasons why you would or would not want a benefit that were used in making the benefit selections (specially at at entry level making $30000). PROCEDURES: Assume that you recently graduated from college and are just starting a new job at a large firm. You will be receiving a starting net pay (net of all taxes and mandatory deductions) of $30,000....
Pittman Company is a small but growing manufacturer of telecommunications equipment. The company has no sales...
Pittman Company is a small but growing manufacturer of telecommunications equipment. The company has no sales force of its own; rather, it relies completely on independent sales agents to market its products. These agents are paid a sales commission of 19% for all items sold. Barbara Cheney, Pittman’s controller, has just prepared the company’s budgeted income statement for next year. The statement follows: Pittman Company Budgeted Income Statement For the Year Ended December 31 Sales $ 17,200,000 Manufacturing expenses: Variable...
Prevosti Farms and Sugarhouse pays its employees according to their job classification. The following employees make...
Prevosti Farms and Sugarhouse pays its employees according to their job classification. The following employees make up Sugarhouse's staff: Employee Number Name and Address Payroll information A-Mille Thomas Millen Hire Date: 2-1-2019 1022 Forest School Rd DOB: 12-16-1982 Woodstock, VT 05001 Position: Production Manager 802-478-5055 PT/FT: FT, exempt SSN: 031-11-3456 No. of Exemptions: 4 401(k) deduction: 3% M/S: M Pay Rate: $35,000/year A-Towle Avery Towle Hire Date: 2-1-2019 4011 Route 100 DOB: 7-14-1991 Plymouth, VT 05102 Position: Production Worker 802-967-5873...
Q1 - The number of adults (people greater than or equal to 15 years of age)...
Q1 - The number of adults (people greater than or equal to 15 years of age) that are considered officially unemployed (by government-calculated statistics) is typically different from (and usually less than) the number of adults actually without a job. This situation may arise because: i) The labor force (as calculated by government statistics) is inclusive only of adults who are either employed or actively seeking employment. ii) Full-time students, homemakers, and retirees are not considered part of the labor...
Part 3 __________ is the organization that enforces the Occupational Safety and Health Act (OSHA). •...
Part 3 __________ is the organization that enforces the Occupational Safety and Health Act (OSHA). • The Justice Department • • The Securities and Exchange Commission   •The Securities Exchange Commission •The Occupational Safety and Health Administration • The Food and Drug Administration Who is covered under the provision of the FLSA that mandates employees working more than 40 hours a week earn time and a half pay? • Regular salespersons • Administrative employees • Outside salespersons • Executives • Professional...
Please read the article below, and answer the questions that follow. In doing so, remember the...
Please read the article below, and answer the questions that follow. In doing so, remember the following, - Although the use of generic theories, covered in class/your module guide/text book will provide a framework, the expectation for the student is to be able to discuss it in context with research relevant to South Africa and your own reflective experiences. - You are required to extensively research current South African trends, amidst our changing political landscape and benchmarked against a global...
Lance H. and Wanda B. Dean are married and live at 431 Yucca Drive, Santa Fe,...
Lance H. and Wanda B. Dean are married and live at 431 Yucca Drive, Santa Fe, NM 87501. Lance works for the convention bureau of the local Chamber of Commerce, while Wanda is employed part-time as a paralegal for a law firm. During 2016, the Deans had the following receipts: Salaries ($60,000 for Lance, $41,000 for Wanda) $101,000 Interest income—    City of Albuquerque general purpose bonds $1,000    Ford Motor company bonds 1,100    Ally Bank certificate of deposit 400 2,500 Child...
In 100 words state if you agree or disagree with the summary given for the Scenario....
In 100 words state if you agree or disagree with the summary given for the Scenario. PLEASE reframe from using Overuse of ambiguous terms such as it, this, and they should not be used. Scenario Part 1: Workplace unrest Environment: You are the Director of a team of employees that do various PA duties. The team consists of 15 employees that are assigned duties in different building locations and collocated with other PA personnel from other directorates in a matrix...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT