1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lemur [1.5K]
3 years ago
13

This program uses hours, pay rate, state tax and fed tax to determine gross

Computers and Technology
1 answer:
Kryger [21]3 years ago
8 0

Answer:

See explaination

Explanation:

#include <fstream>

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

// Fill in the code to define payfile as an input file

ifstream payfile;

float gross;

float net;

float hours;

float payRate;

float stateTax;

float fedTax;

cout << fixed << setprecision(2) << showpoint;

// Fill in the code to open payfile and attach it to the physical file

// named payroll.dat

payfile.open("payroll.dat");

// Fill in code to write a conditional statement to check if payfile

// does not exist.

if(!payfile)

{

cout << "Error opening file. \n";

cout << "It may not exist where indicated" << endl;

return 1;

}

ofstream outfile("pay.out");

cout << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

outfile << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

// Fill in code to prime the read for the payfile file.

payfile >> hours;

// Fill in code to write a loop condition to run while payfile has more

// data to process.

while(!payfile.eof())

{

payfile >> payRate >> stateTax >> fedTax;

gross = payRate * hours;

net = gross - (gross * stateTax) - (gross * fedTax);

cout << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

outfile << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

payfile >> hours ;// Fill in the code to finish this with the appropriate

// variable to be input

}

payfile.close();

outfile.close();

return 0;

}

You might be interested in
Convert to binary140
marshall27 [118]

00110001 00110100 00110000

5 0
3 years ago
Write the interface (.h file) of a class Counter containing: A data member counter of type int. A data member named counterID of
OlgaM077 [116]

Explanation:

See the attached image for The interface (.h file) of a class Counter

8 0
3 years ago
There is always this thing that comes out and I can't answer one's question. How do I undo this?
Y_Kistochka [10]
You should enter your email address
8 0
3 years ago
Read 2 more answers
(Java) Can anyone help me with this ?? The skeleton of the code must be same as the image.
Kay [80]
Is that a essay ur supposed to write

6 0
3 years ago
What is a text feature that could add visual interest and clarity to a procedural document?
rjkz [21]

Bullet points is another

3 0
3 years ago
Read 2 more answers
Other questions:
  • Why does the PC send out a broadcast ARP prior to sending the first ping request
    12·1 answer
  • What element of a timeline helps to mark progress of the project?
    15·1 answer
  • You resurrected an old worksheet. It appears to contain most of the information that you need, but not all of it. Which step sho
    5·1 answer
  • Why are coders using encoder software? What are their advantages and disadvantages? And when might a coder need to use the codin
    12·1 answer
  • In order to get a comprehensive evaluation of the computer programmers he managed, Justin organized a(n) __________, where he as
    11·1 answer
  • The challenge of preparing for ____________________ is in ensuring that employees do not feel that they are being prepared for t
    7·1 answer
  • Explain the paging concept and main disadvantages of pipelined
    15·1 answer
  • What is the value of the variable result after these lines of code are executed?
    11·1 answer
  • What are the peripherals of a computer ​
    12·1 answer
  • WRITE A PROGRAM TO CALCULATE SIMPLE INTEREST
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!