Answered step by step
Verified Expert Solution
Question
1 Approved Answer
CSCI 14-02 Assignment 2, 25 Points, Due 2/14/19 If Statements Write the program logic that will compute the paycheck of an employee. This is as
CSCI 14-02 Assignment 2, 25 Points, Due 2/14/19 If Statements Write the program logic that will compute the paycheck of an employee. This is as much an exercise in designing your logic as much as a programming exercise in the grammar and syntax. Your program's logic will perform a user to perform the following I. Enter the employee's LAST Name 3. Enter the employee's ID Number worked up to a maximum of 60 hours 5. Enter the employee's Pay Per Hour a) Compute the Regular Pay (any hours un to 40 hours) Regular Hours X Pay Per Hour b) Compute the Overtime Pay if ANY (hours OVER 40 hours) Overtime Hours X Pay Per How X2 C"double time" for overtime, assume double) c) Compute Gross Pay Regular Pay+ Overtime Pay (if NO overtime then Overtime Pay is zero) d) Compute Federal Taxes withheld (assume 20% rate, ie. 0.2) Gross Pay X F e) Compute State Taxes withheld (assume 5% rate, ie. 0.05) Gross PayX SteTar Rate 0 Compute Net Pay (Gross Pay-Federal Taxes Withheld State Taves Withheld) ederal Tar Rate Output the employee's LAST Name, FIRST Name, ID Number, Total Hours, Regular Hours, Overtime Hours, if any (ifNO overtime hours then don't print it), Gross Pay, Regular Pay, Overtime Pay, if any (if NO overtime hours then don't print it), Federal Taxes Withheld, State Taxes Withheld, Net Pay. Output format, I leave to your imagination (i.e. some sort of if statement?). Use the cout.setf ios options: #include cconio.h> Winclude ciomanip> #include iostream> using namespace std; int main( string lastname, firstname, empid; cout.precision(2); cout.setf(ios::fixed, ios:floatfield); cout.setf(ios::showpoint); coutsrttoio fid, fotani more tn 0 Use ifstatements to prevent erroneous data values from being entered, i.e. negative pay rate or hour values. Check for total hours "OVER 40" to determine if there are any overtime hours to compute any overtime pay. We can now do data input error checking Maximum number of work hours is 60 hours .Anything OVER 40 hours is Overtime .40 hours or less -NO overtime hours Minimum wage is $10.75 per hour, wage rate less than minimum, default to minimum wage Maximum wage is $100 per hour, wage rate over maximum, default to maximum wage
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started