Question: You are required to complete the tasks described below. Test program The following program has been implemented for a newly proposed tax calculation formula for
You are required to complete the tasks described below.
Test program
The following program has been implemented for a newly proposed tax calculation formula for residents of a fictitious country.
incomeList: the array recording the individual income items
childList: the array recording the ages of children supported by this person
parentList: the array recording the ages of parents supported by this person
public double computeTaxdouble incomeList, int parentList, int childList
double taxAmount ;
double incomeAmount ;
calculate the income amount
for int i ; i incomeList.length; i
incomeAmount incomeAmount incomeListi;
calculate the basic tax
if incomeAmount
taxAmount incomeAmount ;
else if incomeAmount && incomeAmount
taxAmount incomeAmount ;
else if incomeAmount && incomeAmount
taxAmount incomeAmount ;
else if incomeAmount
taxAmount incomeAmount ;
calculate the tax exemption from having children
int taxExemption ;
int numOfChild childList.length;
while numOfChild
if childListnumOfChild
taxAmount taxAmount ;
taxExemption taxExemption ;
numOfChild;
calculate the tax exemption from having parents
for int j ; j parentList.length; j
if parentListj
taxAmount taxAmount ;
taxExemption taxExemption ;
the maximum tax exemption is each person
if taxExemption
if taxAmount
return taxAmount;
else ie taxAmount
return ;
else ie taxExemption
taxAmount taxAmount taxExemption ;
return taxAmount;
Your Tasks
Draw the control flow graph for this program.
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
