Question

In: Computer Science

TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Instructions Write a program that implements...

TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING)

C++ CODE

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 - 3have 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,noOfServiceYearsdenotes 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.

Solutions

Expert Solution

Solution:

C++ Code:

#include <iostream>
using namespace std;

int main() {
  
   double baseSalary;
   cout << "Enter the Base Salary: ";
   cin >> baseSalary;
  
   int noOfServiceYears;
   cout << "Enter the number of Service years: ";
   cin >> noOfServiceYears;
  
   double totalSales;
   cout << "Enter the total sales made: ";
   cin >> totalSales;
  
   double salary = baseSalary;
   double bonus = 0;
   double additionalBonus = 0;
  
   if(noOfServiceYears > 5){
       bonus = 20*noOfServiceYears;
   }else{
       bonus = 10*noOfServiceYears;
   }
  
   if(totalSales>=5000 && totalSales<10000){
       additionalBonus = 0.03*totalSales;
   }else if(totalSales >= 10000){
       additionalBonus = 0.06*totalSales;
   }
  
   salary += (bonus + additionalBonus);
   cout << "Total Salary: " << salary << "$";
   return 0;
}

Sample Output:


Related Solutions

TEXT ONLY PLEASE ( PLEASE NO PDF OR WRITING) C++ CODE Instructions In a right triangle,...
TEXT ONLY PLEASE ( PLEASE NO PDF OR WRITING) C++ CODE Instructions In a right triangle, the square of the length of one side is equal to the sum of the squares of the lengths of the other two sides. Write a program that prompts the user to enter the lengths of three sides of a triangle and then outputs a message indicating whether the triangle is a right triangle. If the triangle is a right triangle, output It is...
TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Summary Samantha and Vikas are looking...
TEXT ONLY PLEASE (PLEASE NO PDF OR WRITING) C++ CODE Summary Samantha and Vikas are looking to buy a house in a new development. After looking at various models, the three models they like are colonial, split-entry, and single-story. The builder gave them the base price and the finished area in square feet of the three models. They want to know the model(s) with the least price per square foot. Instructions Write a program that accepts as input the base...
PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ PLEASE Summary For each used...
PLEASE TYPE OUT IN TEXT (please no pdf or writing) C++ PLEASE Summary For each used car a salesperson sells, the commission is paid as follows: $20 plus 30% of the selling price in excess of the cost of the car. Typically, the minimum selling price of the car is the cost of the car plus $200 and the maximum selling price is the cost of the car and $2,000. Instructions Write a program that prompts the user to enter:...
please write a C program that implements Quick Sort algorithm.
please write a C program that implements Quick Sort algorithm.
Using C++, write a code that this program always stores text file output into a text...
Using C++, write a code that this program always stores text file output into a text file named "clean.txt". -The program should read one character at a time from "someNumbers.txt", and do the following. -If it is a letter, print that letter to the screen, AND also store it in the text file. All letters should be converted to lowercase beforehand. -If it is a number, print that number to screen, but do NOT store it in the text file....
write pseudocode for the following problems not c code Pseudocode only Write a C program to...
write pseudocode for the following problems not c code Pseudocode only Write a C program to print all natural numbers from 1 to n. - using while loop Write a C program to print all natural numbers in reverse (from n to 1). - using while loop Write a C program to print all alphabets from a to z. - using while loop Write a C program to print all even numbers between 1 to 100. - using while loop...
Write a C++ program using produces Huffman code for a string of text entered by the...
Write a C++ program using produces Huffman code for a string of text entered by the user. Must accept all ASCII characters.
C++ Code You will write a program to process the lines in a text file using...
C++ Code You will write a program to process the lines in a text file using a linked list and shared pointers. You will create a class “Node” with the following private data attributes: • Line – line from a file (string) • Next (shared pointer to a Node) Put your class definition in a header file and the implementation of the methods in a .cpp file. The header file will be included in your project. If you follow the...
Code in C# please. Write a program that will use the greedy algorithm. This program will...
Code in C# please. Write a program that will use the greedy algorithm. This program will ask a user to enter the cost of an item. This program will ask the user to enter the amount the user is paying. This program will return the change after subtracting the item cost by the amount paid. Using the greedy algorithm, the code should check for the type of bill. Example: Cost of item is $15.50 User pays a $20 bill $20...
C++ Code Writing prompt: Grade Calculation: Write a program that asks the user to enter in...
C++ Code Writing prompt: Grade Calculation: Write a program that asks the user to enter in a number greater than or equal to zero and less than or equal to 100. If they do not you should alert them and end the program. Next, determine the letter grade associated with the number. For example, A is any grade between 90 and 100. Report the letter grade to the user.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT