17. Write a program named Payroll that prompts the user for a name, Social Secur
ID: 3877997 • Letter: 1
Question
17. Write a program named Payroll that prompts the user for a name, Social Security number, hourly pay rate, and number of hours worked. In an attractive format (similar to Figure 2-23), display all the input data as well as the following: .gross pay, defined as hourly pay rate times hours worked federal withholding tax, defined as 15 percent of the gross pay state withholding tax, defined as 5 percent of the gross pay net pay, defined as gross pay minus taxes CNCaNChapter.82>Payroll Enter your nane: Ruth Roberts ocial Security number: 987-65-4320 lourly pay rate: 13.58 lours worked: 36 Payro11 Sunnary for: Ruth Roberts SSN: 987-65-4320 You worked 36 hours at $13.58 per hour Gross pay Federal withholding: State withholding $486.00 $72.90 24.30 Net pay $388.88 CaNCit Chapter.82Explanation / Answer
//Here is the code, do comment fi you have any doubt. Thumbs up if this helps!
#include <iostream>
using namespace std;
int main() {
// your code goes here
char name[20];
cin.getline(name,20,' ');
char ssn[15];
cin.getline(ssn,15,' ');
int rate,hrs;
cin>>rate>>hrs;
cout<<"Gross Pay : "<<rate*hrs;
cout<<" Federal Tax : "<<rate*hrs*0.15;
cout<<" State Tax : "<<rate*hrs*0.05;
cout<<" Net Pay : "<<rate*hrs-rate*hrs*0.2;
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.