Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // hagendNetPay.cpp : This file contains the 'main' function. Program execution begins and ends there.
- //
- /* Program Name: NetPay.cpp
- Function: This program calculates employee net pay value. All employees have a standard $45 deduction from their checks.
- If an employee does not earn enough to cover the deduction, an error is displayed.
- */
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- // Declare variables
- string name;
- int hours;
- int DEDUCTION = 45;
- int gross;
- int net;
- int rate;
- string EOFNAME = "ZZZ";
- // Declare input items
- cout << "first name or " << EOFNAME << " to quit ";
- cin >> name;
- if (name != EOFNAME)
- {
- cout << "Enter hours worked for " << name << endl;
- cin >> hours;
- cout << "Enter hourly rate for " << name << endl;
- cin >> rate;
- gross = hours * rate;
- net = gross - DEDUCTION;
- }
- while (net > 0)
- {
- cout << "Net pay for " << name << " is " << net << endl;
- }
- if (net < 0)
- {
- cout << "Deductions not covered. Net is 0.";
- }
- {
- cout << "Enter next name or " << EOFNAME << " to quit ";
- }
- return 0;
- } //end of main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement