In: Computer Science
Chapter 2, Problem 4E in An Introduction to Programming with C++
All of the employees at Merks Sales are paid based on an annual salary rather than an hourly wage. However, some employees are paid weekly while others are paid every other week (biweekly). Weekly employees receive 52 paychecks; biweekly employees receive 26 paychecks. The payroll manager wants a program that displays two amounts: an employee’s weekly gross pay and his or her biweekly gross pay. Complete an IPO chart for this problem. Desk-check the algorithm using $56,700 as the salary. Then desk-check it using $32,660.
I am requesting help on creating the algorithm and desk checking it.
Program
#include<iostream>
//Use std namespace
using namespace std;
//Define a main method
int main()
{
//Declare variable
int n;
//Declare variable
float sal, wgp, bwgp, wp, bwp;
//Loop infinite
while(1)
{
//Display message
cout<<"Enter salary";
//Store value
cin>>sal;
//Compute weekly pay
wgp = sal/52;
//Compute bi weekly pay
bwgp = sal/26;
//Display message
cout<<"\n Salary = "<<sal<<"\n";
//Display message
cout<<"Weekly Gross Pay = "<<wgp<<"\n";
//Display message
cout<<"Biweekly Gross Pay ="<<bwgp<<"\n";
//Display message
cout<<"Enter 0 to terminate or any int value to continue";
//Store value
cin>>n;
//If value is 0
if(n==0)
//Break
break;
}
//Display new line
cout<<"\n";
//Pause console window
system("pause");
//Return 0
return 0;
}