ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 25 Apr 2017 My Price 12.00

PAYROLL SYSTEM PHASE 3: LOOP

c++ PROGRAM HELP, BEGINNER

 

Below is what I'm working on, I've already done 3A. Now I'm working on the rest. the program that I'm working with is attached to the bottom of the page as well as the small table of data relevant to the program.

 

 

M2 Written Assignment - Loops and Ifs

PAYROLL SYSTEM PHASE 3: LOOP

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. ALREADY DONE.

                       ………….…………..

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.

 

 

 

This is what I have now. It's failing in my compiler and after 4 hours, I can't get it to work in either of my computers. I have numerous compilers, Dev C++, Codeblocks (my preferred) as well as Turbo C.

 

 

#include <iostream>

#include <fstream>

using namespace std;

   int main(){

   ifstream input; //file for opening input info for employee data

   input.open ("employee.txt")//create the file for review after completion

 

   int numberofemployees;

   int employeeid, hoursworked;

float hourlyrate, grosspay, taxamount, netpay;

 

const float TAXRATE = 0.20;

 

numberofemployees = 0;

 

while( input>>employeeid>>hoursworked>>hourlyrate ){

grosspay=hoursworked*hourlyrate;

taxamount=grosspay*TAXRATE;

netpay=grosspay-taxamount;

 

 

cout << "Thank You for working at Dr. Ebrahimi.com Inc.!" <<;

cout << "EMPLOYEE ID IS"<<employeeid << endl;

cout << "THE HOURS WORKED ARE"<<hoursworked<< endl;

cout << "THE HOURLY RATE IS"<<hourlyrate<<endl;

cout << "YOUR GROSSPAY IS"<<grosspay << endl;

cout << "YOUR TAX AMOUNT IS"<<taxamount<<endl;

cout << "YOUR NETPAY IS"<<netpay<<endl<<endl;

numberofemployees = numberofemployees + 1;

}//WHILE

input.close ();//close the before created file

system("PAUSE");

return 0;

}//MAIN

 

 EMPLOYEE DATA INFO FOR TEXT FILE

1645   10   9.99

8932   40   20.00

7104   20   15.99

2816   15   50.00

5387   30   6.99

Answers

(11)
Status NEW Posted 25 Apr 2017 04:04 AM My Price 12.00

-----------

Attachments

1499823704-Q3Q4.zip
file 1499824037-Answer Answer.docx preview (4974 words )
A-----------nsw-----------er ----------- Em-----------plo-----------yee-----------.h#-----------ifn-----------def----------- __-----------EMP-----------LOY-----------EE_-----------H__----------- #-----------def-----------ine----------- __-----------EMP-----------LOY-----------EE_-----------H__----------- #-----------inc-----------lud-----------e &-----------amp-----------;lt-----------;st-----------rin-----------g&a-----------mp;-----------gt;----------- n-----------ame-----------spa-----------ce -----------Rec-----------ord-----------s -----------{ ----------- ----------- ----------- c-----------las-----------s E-----------mpl-----------oye-----------e ----------- ----------- ----------- {----------- ----------- ----------- ----------- pu-----------bli-----------c: ----------- ----------- ----------- ----------- ----------- ----------- v-----------irt-----------ual----------- vo-----------id -----------set-----------_id-----------(lo-----------ng)-----------; ----------- ----------- ----------- ----------- ----------- ----------- vi-----------rtu-----------al -----------lon-----------g g-----------et_-----------id(-----------); ----------- ----------- ----------- ----------- ----------- ----------- v-----------irt-----------ual----------- vo-----------id -----------set-----------_fi-----------rst-----------_na-----------me(-----------std-----------::s-----------tri-----------ng -----------in_-----------fir-----------st_-----------nam-----------e);----------- ----------- ----------- ----------- ----------- ----------- -----------vir-----------tua-----------l s-----------td:-----------:st-----------rin-----------g g-----------et_-----------fir-----------st_-----------nam-----------e()-----------; ----------- ----------- ----------- ----------- ----------- ----------- vi-----------rtu-----------al -----------voi-----------d s-----------et_-----------las-----------t_n-----------ame-----------(st-----------d::-----------str-----------ing----------- in-----------_la-----------st_-----------nam-----------e);-----------
Not Rated(0)