Respuesta :
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.
