Loops & Ifs

The main purpose of this phase is to get accustomed to the repetition of a program using a loop and reading data interactively as well from an external file.

Hint: Use a while loop.

3A) Expand your Payroll Program so that it interactively repeats for as many employees as the user specifies:

Example:

How many employees would you like to enter? 5
Enter Employee Id 6740
Enter Hours Worked 40
Enter Hourly Rate $10
Employee Id is 6740
The Hours Worked are 40
The Hourly Rate is $10
The Gross Pay is $400
The Tax Amount is $120
The Net Pay is $280
Enter Employee Id 3578
Enter Hours Worked 30
Enter Hourly Rate 10

 

 

………….…………..

………….…………..

 

 

3B) Expand your Payroll program so that it repeats for as many employees are in the input file.

 

Data typed and saved under employee.in

 

Use:

 

#include
#include
using namespace std;
…….
ifstream fin(“employee.in”);
………
while(fin>>employeeid>>hoursworked>>hourlyrate){…….…..}//end loop

 

 

 

 

PAYROLL SYSTEM PHASE 4: DECISION-MAKING

In this phase of the payroll system, we are going to include the appropriate tax rate (variable) rather than a fixed tax rate of 10% (constant). The program will also compute the overtime pay.

 

4A) Assign different tax rates based on the following gross pay:

 

  • If gross pay is more $1000, the tax rate is 30%
  • If the gross pay is more than $800.00 and less than or equal to $1000.00, then the tax rate is 20%.
  • If the gross pay is more than $500.00 and less than $800.00, then the tax rate is 10%
  • If gross pay is more than or equal to 0 and less than or equal to 500 tax rate is 0.

 

The tax rate will also vary based on marital status. Add 5% to the tax rate of a single person and subtract 5% if head of household.

Declare marital status as a character:  S=Single M=Married H=Head of Household

Program should accept either upper case or lower case letters for marital status (e.g. accept M or m).

4B) Compute the overtime pay according to the following formula:

Any hours over 40 are considered time and a half (overtime).
You may want to find overtime hours (e.g. hoursworked – 40) and overtime pay (e.g. overtimehours*hourlyrate * 1.5).

You should submit a copy of your program.
You should also paste a copy of your output and document your program and submit it as a Word document.

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
$26
The price is based on these factors:
Academic level
Number of pages
Urgency
Basic features
  • Free title page and bibliography
  • Unlimited revisions
  • Plagiarism-free guarantee
  • Money-back guarantee
  • 24/7 support
On-demand options
  • Writer’s samples
  • Part-by-part delivery
  • Overnight delivery
  • Copies of used sources
  • Expert Proofreading
Paper format
  • 275 words per page
  • 12 pt Arial/Times New Roman
  • Double line spacing
  • Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Read more

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Read more

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.

Read more

Privacy policy

Your email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.

Read more

Fair-cooperation guarantee

By sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.

Read more