Update Project_3.c

+- Modified Spacing, made sure lines don't go above 80 characters, and formatting is better.
This commit is contained in:
Charles Descamps 2022-09-20 11:50:30 -07:00
parent d331ebfeaa
commit 5e7fb8d089

View file

@ -60,32 +60,57 @@ int main()
contributionToIRA = promptForInteger("Your IRA Contributions $: ");
// conduct computations
// totalIncome is user input
// IRA Contributions are subtracted from totalIncome to get a modified income (adjusted).
// IRA Contributions are subtracted from totalIncome
// to get a modified income (adjusted).
adjustedIncome = totalIncome - contributionToIRA;
// Calculate the minimum Federal Tax that would have to be paid, using MIN_FED_TAX * PERCENTAGE_CONVERSION * adjustedIncome
// Calculate the minimum Federal Tax that would have to be paid,
// using MIN_FED_TAX * PERCENTAGE_CONVERSION * adjustedIncome
minTaxFederal = MIN_FED_TAX * PERCENTAGE_CONVERSION * adjustedIncome;
// Calculate the maximum Federal Tax that would have to be paid, using MAX_FED_TAX * PERCENTAGE_CONVERSION * adjustedIncome
// Calculate the maximum Federal Tax that would have to be paid,
// using MAX_FED_TAX * PERCENTAGE_CONVERSION * adjustedIncome
maxTaxFederal = MAX_FED_TAX * PERCENTAGE_CONVERSION * adjustedIncome;
// Calculate the minimum AZ State Tax that would have to be paid, using MIN_AZ_TAX * PERCENTAGE_CONVERSION * adjustedIncome
// Calculate the minimum AZ State Tax that would have to be paid,
// using MIN_AZ_TAX * PERCENTAGE_CONVERSION * adjustedIncome
minTaxArizona = MIN_AZ_TAX * PERCENTAGE_CONVERSION * adjustedIncome;
// Calculate the maximum AZ State Tax that would have to be paid, using MAX_AZ_TAX * PERCENTAGE_CONVERSION * adjustedIncome
// Calculate the maximum AZ State Tax that would have to be paid,
// using MAX_AZ_TAX * PERCENTAGE_CONVERSION * adjustedIncome
maxTaxArizona = MAX_AZ_TAX * PERCENTAGE_CONVERSION * adjustedIncome;
// Calculate the Social Security Tax that would have to be paid, using TAX_SSN * PERCENTAGE_CONVERSION * adjustedIncome
// Calculate the Social Security Tax that would have to be paid,
// using TAX_SSN * PERCENTAGE_CONVERSION * adjustedIncome
taxSSN = TAX_SSN * PERCENTAGE_CONVERSION * adjustedIncome;
// Calculate the Medicare Tax that would have to be paid, using TAX_MC * PERCENTAGE_CONVERSION * adjustedIncome
// Calculate the Medicare Tax that would have to be paid,
// using TAX_MC * PERCENTAGE_CONVERSION * adjustedIncome
taxMC = TAX_MC * PERCENTAGE_CONVERSION * adjustedIncome;
// Calculate the minimum amount of tax that would have to be paid, using minTaxFederal + minTaxArizona + taxSSN + taxMC
// Calculate the minimum amount of tax that would have to be paid,
// using minTaxFederal + minTaxArizona + taxSSN + taxMC
minTaxTotal = minTaxFederal + minTaxArizona + taxSSN + taxMC;
// Calculate the maximum amount of tax that would have to be paid, using maxTaxFederal + maxTaxArizona + taxSSN + taxMC
// Calculate the maximum amount of tax that would have to be paid,
// using maxTaxFederal + maxTaxArizona + taxSSN + taxMC
maxTaxTotal = maxTaxFederal + maxTaxArizona + taxSSN + taxMC;
// Calculate the maximum income after tax has been paid, using totalIncome - minTaxTotal
// Calculate the maximum income after tax has been paid,
// using totalIncome - minTaxTotal
maxIncome = totalIncome - minTaxTotal;
// Calculate the minimum income after tax has been paid, using totalIncome - maxTaxTotal
// Calculate the minimum income after tax has been paid,
// using totalIncome - maxTaxTotal
minIncome = totalIncome - maxTaxTotal;
// Calculate the minimum tax rate, using minTaxTotal / totalIncome / PERCENTAGE_CONVERSION
// Calculate the minimum tax rate,
// using minTaxTotal / totalIncome / PERCENTAGE_CONVERSION
minEffectiveTax = (minTaxTotal / totalIncome) / PERCENTAGE_CONVERSION;
// Calculate the maximum tax rate, using maxTaxTotal / totalIncome / PERCENTAGE_CONVERSION
// Calculate the maximum tax rate,
// using maxTaxTotal / totalIncome / PERCENTAGE_CONVERSION
maxEffectiveTax = (maxTaxTotal / totalIncome) / PERCENTAGE_CONVERSION;
// display results
@ -98,7 +123,7 @@ int main()
// print title line
// function: printCharacter, printStringJustified, printEndline
printCharacter( PIPE );
printStringJustified( "DUMMY TAX CALCULATIONS",
printStringJustified( "DUMMY TAX CALCULATIONS",
TABLE_WIDTH - 2, "CENTER" );
printCharacter( PIPE );
printEndline();
@ -137,7 +162,8 @@ int main()
printCharacter( PIPE );
printDoubleJustified( minEffectiveTax, PRECISION, VALUE_WIDTH -1, "RIGHT" );
printString( SPACE_PIPE );
printDoubleJustified( maxEffectiveTax, PRECISION, VALUE_WIDTH - 1, "RIGHT" );
printDoubleJustified( maxEffectiveTax, PRECISION,
VALUE_WIDTH - 1, "RIGHT" );
printString( SPACE_PIPE );
printEndline();
@ -187,4 +213,3 @@ int main()
// supporting functions
// none