Here's my C++ programming coding assignment for 4-11: Instructions Write a program that implements the algorithm given in Example 1 - 3 (Chapter 1), which determines the monthly wages of a salesperson. The instructions for Example 1 - 3 have been posted below for your convenience.Example 1 - 3 Every salesperson has a base salary. The salesperson also receives a bonus at the end of each month, based on the following criteria: If the salesperson has been with the store for five years or less, the bonus is $10 for each year that he or she has worked there. If the salesperson has been with the store for more than five years, the bonus is $20 for each year that he or she has worked there. The salesperson can earn an additional bonus as follows: If the total sales made by the salesperson for the month are at least $5,000 but less than $10,000, he or she receives a 3% commission on the sale. If the total sales made by the salesperson for the month are at least $10,000, he or she receives a 6% commission on the sale. To calculate a salesperson’s monthly paycheck, you need to know the base salary, the number of years that the salesperson has been with the company, and the total sales made by the salesperson for that month. Suppose baseSalary denotes the base salary,noOfServiceYears denotes the number of years that the salesperson has been with the store,bonus denotes the bonus, totalSales denotes the total sales made by the salesperson for the month, and additionalBonus denotes the additional bonus. Since your program handles currency, make sure to use a data type that can store decimals with a precision to 2 decimals Here's what I have for my program: #include <iostream>#include <iomanip>#include <string> using namespace std;const const main (){//Declare variablesint baseSalary;int noOfServiceYears;double bonus;double totalSales;double additionalSales;double additionalBonus;double payCheck; cout << fixed << showpoint << setprecision(2);//Get the employee's Base Salarycout << "Please enter the employee's Base Salary: ";cin >> baseSalary << endl; //Get the employee's number of years of service with the companycout << "Please enter the employee's number of years of service: ";cin >> noOfServiceYears << endl; //Calculate the employee's bonus using the following formulaif (noOfServiceYears <= 5)bonus = 10 * noOfServiceYears;elsebonus = 20 * noOfServiceYears; //Get the employee's total number of salescout << "Please enter the employee's recordered number of sales: ";cin >> totalSales << endl; //Calculate the employee's additional bonus using the following formulaif (totalSales < 5000)additionalBonus = 0;else if (totalSales <= 5000 && totalSales < 10000)additionalBonus = totalSales * 0.03;elseadditionalBonus = totalSales * 0.06; //Calculate the employee's paycheck using the following equationpayCheck = baseSalary + bonus + additionalBonus; cout << "The employee's gross-adjusted monthly salary is: " << payCheck << endl;cin >> payCheck return 0;} I know that my programed parameters is correct. My problem with my program is that I'm missing two constant variables for the bonus calculations of 10 and 20 * noOfServiceYears. Also, I need to input a constant variable for the additionalBonus calculations of 0.03 and 0.06 to complete my program, but I have no idea how to write them within the context of my program. Everytime I think I got it right, my program goes out-of-whack. Can someone help me? I don't want to copy anyone's work. I will only use your ideas as a reference point to complete my code, ok? I believe in doing my own work.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
Question

Here's my C++ programming coding assignment for 4-11:

Instructions

Write a program that implements
the algorithm given in Example 1 - 3
(Chapter 1), which determines the
monthly wages of a salesperson.
The instructions for Example 1 - 3
have been posted below for your
convenience.

Example 1 - 3

Every salesperson has a base
salary. The salesperson also
receives a bonus at the end of each
month, based on the following
criteria: If the salesperson has been
with the store for five years or less,
the bonus is $10 for each year that
he or she has worked there. If the
salesperson has been with the
store for more than five years, the
bonus is $20 for each year that he
or she has worked there. The
salesperson can earn an additional
bonus as follows: If the total sales
made by the salesperson for the
month are at least $5,000 but less
than $10,000, he or she receives a
3% commission on the sale. If the
total sales made by the salesperson
for the month are at least $10,000,
he or she receives a 6%
commission on the sale.

To calculate a salesperson’s
monthly paycheck, you need to
know the base salary, the number
of years that the salesperson has
been with the company, and the
total sales made by the salesperson
for that month. Suppose
baseSalary denotes the base
salary,noOfServiceYears denotes
the number of years that the
salesperson has been with the
store,bonus denotes the bonus,
totalSales denotes the total sales
made by the salesperson for the
month, and additionalBonus
denotes the additional bonus.

Since your program handles
currency, make sure to use a data
type that can store decimals with a
precision to 2 decimals

Here's what I have for my program:

#include <iostream>
#include <iomanip>
#include <string>

using namespace std;
const
const

main ()
{
//Declare variables
int baseSalary;
int noOfServiceYears;
double bonus;
double totalSales;
double additionalSales;
double additionalBonus;
double payCheck;

cout << fixed << showpoint << setprecision(2);
//Get the employee's Base Salary
cout << "Please enter the employee's Base Salary: ";
cin >> baseSalary << endl;

//Get the employee's number of years of service with the company
cout << "Please enter the employee's number of years of service: ";
cin >> noOfServiceYears << endl;

//Calculate the employee's bonus using the following formula
if (noOfServiceYears <= 5)
bonus = 10 * noOfServiceYears;
else
bonus = 20 * noOfServiceYears;

//Get the employee's total number of sales
cout << "Please enter the employee's recordered number of sales: ";
cin >> totalSales << endl;

//Calculate the employee's additional bonus using the following formula
if (totalSales < 5000)
additionalBonus = 0;
else if (totalSales <= 5000 && totalSales < 10000)
additionalBonus = totalSales * 0.03;
else
additionalBonus = totalSales * 0.06;

//Calculate the employee's paycheck using the following equation
payCheck = baseSalary + bonus + additionalBonus;

cout << "The employee's gross-adjusted monthly salary is: " << payCheck << endl;
cin >> payCheck

return 0;
}

I know that my programed parameters is correct. My problem with my program is that I'm missing two constant variables for the bonus calculations of 10 and 20 * noOfServiceYears. Also, I need to input a constant variable for the additionalBonus calculations of 0.03 and 0.06 to complete my program, but I have no idea how to write them within the context of my program. Everytime I think I got it right, my program goes out-of-whack. Can someone help me? I don't want to copy anyone's work. I will only use your ideas as a reference point to complete my code, ok? I believe in doing my own work.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 5 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr