(Part A) : Family Tax Creit – 50 points
Create the following 4- function C++ program: A family can claim $1000 tax credit per child, but the total child tax credit cannot exceed $4000. Recently the tax law has changed. The $4000 upper limit applies only if the family income exceeds $70,000. In other words, families with income more than $70,000 can claim $4000 child tax credit at the most, but families with income $70,000 or less can claim more than $4000 child tax credit if there are more than 4 children ($1000 credit per child). Write a new program to calculate child tax credit. In addition to main(), also use the following two functions in your program:
getnumChildren() : a value-returning function that asks for the number of children. Use a return statement to send it to main().
getIncome() : a value-returning function that asks for the family income. Use a return statement to send it to main().
calcCredit() : a value-returning function that calculates and returns child tax credit to main().
The main() function should display the total tax credit on the computer screen.
Expert Answer
Solution:
#include<iostream>
using namespace std;
int getNumChildren(){ // Method to get the number of children
int numChildren;
cout<<“Enter the number of children the family have: “;
cin>>numChildren; //Input number of children
return numChildren; // Return the value
}
int getIncome(){
int familyIncome;
cout<<“nEnter the family income: “;
cin>>familyIncome; //Input family income
return familyIncome; // Return the value
}
int calcCredit(int numChildren, int familyIncome){ // Function to calculate tax credit
int taxCredit;
if(familyIncome>70000){
if(numChildren>=4)
taxCredit= 4000;
else
taxCredit= numChildren*1000;
}
else
{
taxCredit= numChildren*1000;
}
return taxCredit;
}
int main(){
int numChildren, familyIncome, taxCredit;
numChildren= getNumChildren(); // Calling function to get number of chidren in the family
familyIncome= getIncome(); // Calling function to get income
taxCredit= calcCredit(numChildren, familyIncome); // Calling calculate tax credit
cout<<“nThe child tax credit is: “<<taxCredit;
return 0;
}
Output: