Question: Write a program that can be used to calculate the federal tax. This is my code, my output is correct but i get this error:
Write a program that can be used to calculate the federal tax.
This is my code, my output is correct but i get this error:
Status: FAILED! Check: Test: Successful Output II Reason: Unable to find in the program's output. Enter M for married or S for single: Enter gross salary: Enter pension fund percentage up to : Marital Status: Single Number of People: Income earned: $ Pension Plan Contribution: $ Taxable Income: $ The federal tax payable is: $ Error : AssertionError Unable to find a number close enough to in the program's output.
here is my code:
#include
#include
#include
using namespace std;
void getDatachar &mStatus, int &numOfPpl, double &grossSalary, double &pensionFund
cout "Enter M for married or S for single: ;
cin mStatus;
mStatus touppermStatus;
if mStatus M
int children;
cout "Enter number of children under : ;
cin children;
numOfPpl children;
else
numOfPpl ;
cout "Enter gross salary: ;
cin grossSalary;
cout "Enter pension fund percentage up to : ;
cin pensionFund;
if pensionFund && pensionFund
pensionFund pensionFund grossSalary;
else
cout "Invalid percentage. Please enter a value up to
;
double taxAmountchar mStatus, int numOfPpl, double grossSalary, double pensionFund
double standardExemption mStatus M : ;
double personalExemption mStatus M numOfPpl : ;
double taxableIncome grossSalary standardExemption pensionFund personalExemption;
double tax ;
if taxableIncome
tax taxableIncome ;
else if taxableIncome
tax taxableIncome ;
else
tax taxableIncome ;
return tax;
int main
char mStatus;
int numOfPpl;
double grossSalary, pension, federalTax;
getDatamStatus numOfPpl, grossSalary, pension;
federalTax taxAmountmStatus numOfPpl, grossSalary, pension;
cout fixed showpoint setprecision;
cout "Marital Status is: mStatus M "Married" : "Single" endl;
cout "Number of People is: numOfPpl endl;
cout "Income earned is: $ grossSalary endl;
cout "Pension Plan Contribution is: $ pension endl;
cout "Taxable Income is: $grossSalary pension mStatus M : numOfPpl mStatus M : endl;
cout "The federal tax payable is: $ federalTax endl;
return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
