SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

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

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 2 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 21 Dec 2017 My Price 8.00

data interactively as well from an external file

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

(5)
Status NEW Posted 21 Dec 2017 01:12 PM My Price 8.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)