Code in C++ is given below::
Please read comments for better understanding of the code
Screenshot of output is given at the end.
Code in Cpp::
#include <iostream>
#include<string>
#include<string.h>
using namespace std;
int main() {
/**
* An integer n is declared that stores total number of
personnel
* i is used to loop in for loop
* variable named total stores the summation of bonus.
*/
int n,i,total=0;
/**
* Below user is asked to enter the value of n
**/
cout<<"Enter the number of personnel: ";
cin>>n;
/**
* Following statment is used to clear the buffer
*/
cin.ignore();
/**
* Following for loop runs from 1 to n
*/
for(i=1;i<=n;i++){
/**
* Here in each iteration user is asked to enter a string with space
in string variable named s
*/
cout<<"Enter the type and salary of employee number
"<<i<<": ";
string s;
getline(cin,s);
/**
* Integer salary stores salary of respective type of person
*/
int salary=stoi(s.substr(2,strlen(s.c_str())));
int bonus=0;
char c=s[0];
/**
* depending on the type of person bonus stores the multiple of
salary.
*/
if(c=='w' || c=='W'){
bonus=salary*3;
}else if(c=='e' || c=='E'){
bonus=salary*2;
}else{
bonus=salary;
}
cout<<"The bonus is "<<bonus<<endl;
/**
* total is updated below.
*/
total+=bonus;
}
cout<<"Total bonus: "<<total<<endl;
}
Output::
solve it in C++ please Exercise#2: Personnel Bonus At the end of the financial year one...
Java Description Write a program to compute bonuses earned this year by employees in an organization. There are three types of employees: workers, managers and executives. Each type of employee is represented by a class. The classes are named Worker, Manager and Executive and are described below in the implementation section. You are to compute and display bonuses for all the employees in the organization using a single polymorphic loop. This will be done by creating an abstract class Employee...
Please write code in C++ and include all headers not bits/stdc: 17.10 (Occurrences of a specified character in a string) Write a recursive function that finds the number of occurrences of a specified letter in a string using the following function header. int count(const string& s, char a) For example, count("Welcome", 'e') returns 2. Write a test program that prompts the user to enter a string and a character, and displays the number of occurrences for the character in the...
In header file (.h) and c++ file format (.cpp). A local company has asked you to write a program which creates an Employee class, a vector of Employee class objects, and fills the objects with employee data, creating a "database" of employee information. The program allows the user to repeatedly search for an employee in the vector by entering the employee's ID number and if found, display the employee's data. The Employee_C class should have the following data and in...
in C language we need to find the following : EXERCISE 3: 1. Write the definition of a structure named employee that contains character array members for an employee's first and last names, an int member for the employee's age, a char member that contains 'M' or 'F' for the employee's gender, and a double member for the employee's hourly salary. 2. Using the above mentioned definition, write a C program that asks a user to enter the values of...
Styles Program Description Write a C++ program that computes and displays employees' earnings. Prompt the user for type of employee (hourly ("h"or "H") or management ("'m" or "M") If the employee is management: . get the annual salary get the pay period (weekly ("w" or "W"), bi-weekly ("b" or "B") or monthly ("m" or e compute the gross salary for the pay period (Divide annual salary by 52 for weekly, 26 for bi-weekly, and 12 for monthly) deduct from gross...
A company pays its employees as managers (who receive a fixed weekly salary), hourly workers (who receive a fixed hourly wage for up to the first 40 hours they work and “time-and-a-half,” i.e. 1.5 times their hourly wage, for overtime hours worked), commission workers (who receive $250 plus 5.7% of their gross weekly sales), or pieceworkers (who receive a fixed amount of money per item for each of the items they produce-each pieceworker in this company works on only one...
Please solve the following programming exercise using c++: Write a class named EncryptableString that is derived from the STL string class. The EncryptableString class adds a member function: void encrypt() which encrypts the string contained in the object by replacing each letter with its successor in the ASCII ordering. (For example the string baa encrypted would become cbb. Encrypt it again and the string would become dcc.) Assume that the only characters to be encrypted in an EncryptableString object are...
using C geany. Please Dr. exercise # 1 and 2 During the lab: PART I: PROGRAMMING EXERCISES a. Using Geany, write a C program that prompts and asks the user for two assignment marks (al and a2) and two test marks (ti and t2). All four variables are integer variables and are in % (out of 100). You program should display the four marks properly lalebed to check if the input has been successful. b. Next, calculate and display the...
In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an array of structs to hold the employee information for all employees. If you choose to declare a separate struct for each employee, I will not deduct any points. However, I strongly recommend that you use an array of structs. Be sure to read through Chapter...
Use C++ language, keep it simple Exercise #2: Strings' operations Write a C++ program that prompts the user to enter a sentence, the program then does the following: 1. Prints the total characters in the sentence. 2. Prints the word count of the sentence, assuming only one space between each tow words. 3. Prints total vowel (a, e, i, o, u) in the sentence. 4. Prints the vowel frequency as shown in the sample below. 5. Prints the sentence in...