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
sp2606 [1]
4 years ago
12

In this lab, you complete a C++ program with the provided data files. The program calculates the amount of tax withheld from an

employee’s weekly salary, the tax deduction to which the employee is entitled for each dependent, and the employee’s take- home pay. The program output includes state tax withheld, federal tax withheld, dependent tax deductions, salary, and take-home pay.
Instructions

Ensure the source code file named Payroll.cpp is open in the code editor.

Variables have been declared and initialized for you as needed, and the input and output statements have been written. Read the code carefully before you proceed to the next step.

Write the C++ code needed to perform the following:

Calculate state withholding tax (stateTax) at 6.5 percent
Calculate federal withholding tax (federalTax) at 28.0 percent.
Calculate dependent deductions (dependentDeduction) at 2.5 percent of the employee’s salary for each dependent.
Calculate total withholding (totalWithholding) as stateTax+ federalTax + dependentDeduction.
Calculate take-home pay (takeHomePay) as salary - totalWithholding.
Compile and execute your program by clicking the Run button. You should get the following output:
State Tax: $81.25
Federal Tax: $350
Dependents: $62.5
Salary: $1250
Take-Home Pay: $756.25
This is the code

/ This program calculates an employee's take home pay.
#include
using namespace std;
int main()
{
double salary = 1250.00;
double stateTax;
double federalTax;
double numDependents = 2;
double dependentDeduction;
double totalWithholding;
double takeHomePay;

// Calculate state tax here

cout << "State Tax: $" << stateTax << endl;
// Calculate federal tax here

cout << "Federal Tax: $" << federalTax << endl;
// Calculate dependent deduction here

cout << "Dependents: $" << dependentDeduction << endl;
// Calculate total withholding here

// Calculate take-home pay here

cout << "Salary: $" << salary << endl;

Computers and Technology
1 answer:
musickatia [10]4 years ago
8 0

Answer:

Following are the code to this question:

#include <iostream> //defining header file

using namespace std;

int main() //defining main method

{

const double STATE_TAX=6.5, FEDERAL_TAX=28.0, DEPENDENTS_DEDUCTION=2.5; //defining const variables and assign value

double salary = 1250.00, numDependents = 2; //defining double variable and assign value

double stateTax, federalTax, dependentDeduction, totalWithholding, takeHomePay; //defining double variables

stateTax=salary*(STATE_TAX/100); //Calculate stateTax using formula

federalTax=salary*(FEDERAL_TAX/100);  //Calculate federalTax using formula

dependentDeduction=salary*(DEPENDENTS_DEDUCTION/100)*numDependents; // Calculate dependentDeduction using formula

totalWithholding=stateTax+federalTax+dependentDeduction; //Calculate totalWithholding using formula

takeHomePay=salary-totalWithholding; //Calculate takeHomePay using formula

cout << "State Tax: $" << stateTax << endl; //print stateTax value

cout << "Federal Tax: $" << federalTax << endl; //print federalTax value

cout << "Dependents: $" << dependentDeduction << endl; // print Dependents value

cout << "Salary: $" << salary << endl; //print salary value

cout<<"Take-Home Pay: $"<<takeHomePay<<endl; // Calculate takeHomePay value

return 0;

}

Output:

Please find the attachment.

Explanation:

In the given C++ language program code, inside the main method three double const variable "STATE_TAX, FEDERAL_TAX, and DEPENDENTS_DEDUCTION" is declared, that assign a value, that is "6.5, 28.0, and 2.5", and other double variables that are "salary, numDependents, stateTax, federalTax, dependentDeduction, totalWithholding, takeHomePay", in which salary and numDependents variable assign a value, that is "1250.00, and 2".

  • In the next line, other variable is used, that uses defines the formula according to there values, and calculates and stores its value.
  • In the last step, the print method is used, which prints its calculated value with the message.

You might be interested in
The contents of an array of type ______ can be displayed with the cout operator (without specifying an element). - 1 point(s)
xxMikexx [17]
The contents of an array of type char can be displayed with the cout operator.  <span>Array declarations </span>must<span> contain the information about the size of the array. It is possible to leave the size out of the [ ] in the declaration </span>as long as<span> you initialize the array inline, in which case the array is made just large enough to capture the initialized data. </span>  
5 0
3 years ago
An administrator has added a firewall within an Azure virtual network. What do we know for sure about the firewall?
slavikrds [6]

Answer:

its a host based firewall

Explanation:

because the administrator put it ntentionally and the only way do disable the firewall is by signing in as the admin (if you're the admin) and turn it off manualy

or if you're not the admin, ask them to do so.

5 0
3 years ago
Which of these is a Microsoft certification for system engineers
kow [346]

Answer: B. MCSE

Explanation:

Microsoft offers various courses and certifications for different careers in the IT industry. One such career is system engineering where the MCSE which stands for Microsoft Certified Solutions Expert is offered.

This certification proves that one is proficient with technologies such as server infrastructure, data platforms and business intelligence. Prospective careers apart from sound engineering include Network management and Database Analysis.

7 0
3 years ago
Which is the correct option?
Murljashka [212]

Answer:

C

Explanation:

Key logging is when a hacker can track every key u have clicked.

3 0
3 years ago
If you want to remove meeting responses from your inbox but still want to see tracking options, what should you do? Turn off all
Alla [95]

Answer:

its D. create a tracking rule that moves responses to a new folder.

Explanation:

i just got the answer right on edge 2020.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Define the method object inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids.Sample output for the g
    11·1 answer
  • Who is responsible for customer service?
    14·1 answer
  • In server-side discovery pattern, load balancing and routing of the request to the service instances are taken care of by the se
    9·1 answer
  • What are the pros and cons of the internet’s ability to access information
    8·2 answers
  • Jeremy is working with a team that is creating an application using attributes and associated methods. What type of programming
    8·1 answer
  • MODS ONLY answer this, I have something for you. I'm reporting this to make it easier
    14·1 answer
  • Which formatting options can be changed by selecting the Design tab? Check all that apply.
    7·2 answers
  • An example of documentary evidence that might be presented at trial for a cyber crime is:
    9·1 answer
  • Can someone please do this java lab for me (100 point version)? Im really having trouble. (DO NOT GIVE FAKE, USELESS ANSWERS. I
    14·1 answer
  • One difference between multi-tasking using fork() versus using threads is that there is race condition among threads due to shar
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!