C PROGRAMMING Annual Pay Suppose an employee get paid every

C++ PROGRAMMING

Annual Pay

Suppose an employee get paid every two weeks. In a year the employee get s paid 26 times. Write a C++ program that defines the following variables:

payAmount: This variable will hold the amount of the pay the employee earns each pay period. Your program will ask the user to enter the amount of the pay the employee earn each pay period. (Assume that the employee get the same amount for all pay periods.)

payPeriods: This variable will hold the number of pay periods in a year. Initialize the variable to 26.

annualPay: This variable will hold the employee\'s total annual pay, which will be calculated.

bonusPay: This variable will hold the employee\'s bonus based on the total annual pay. Each employee get 5% of the annual pay as his/her bonus pay. This item will be calculated.

totalPay: This variable will hold the total amount of pay the employee earns for the year, which is the sum of the annual pay and the bonus pay.

The program should ask the user to enter the amount of pay the employee earns each pay period. Then the program will calculate the annual pay by multiplying the employee\'s pay amount by the number of pay periods in a year and store the result in the annualPay variable. The program will then calculate the amount of the bonus by multiplying the annual pay with 5% and store the result in the bonusPay variable. Finally the program will calculate the total pay by adding the annual pay and bonus pay. Display each calculation result.

Solution

#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    double payAmount,annualPay,bonusPay,totalPay = 0;
    //Total Pay periods are 26
    int payPeriods = 26;
    //Get Pay Amount from User
    cout << \"Enter Pay Amount\" << endl;
    cin>>payAmount;

    //Calculate Annnual pay = (Pay Amount * payPeriods)
    annualPay = payAmount*payPeriods;

    //Calucalte Bonus. Bonus = (Annual Pay * 0.05), 0.05 is 5%
    bonusPay = annualPay* 0.05;

    //Calculate Total Pay = (Annual Pay + Bonus)
    totalPay = annualPay+bonusPay;

    //Print the Results
    cout<<\"Pay Amount : \"<<payAmount<<endl;
    cout<<\"Pay Periods : \"<<payPeriods<<endl;
    cout<<\"Annual Pay : \"<<annualPay<<endl;
    cout<<\"Bonus Pay : \"<<bonusPay<<endl;
    cout<<\"Total Pay : \"<<totalPay<<endl;
    return 0;
}

C++ PROGRAMMING Annual Pay Suppose an employee get paid every two weeks. In a year the employee get s paid 26 times. Write a C++ program that defines the follow

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site