From 5e7fb8d089df16f6946d5da0670bcc059ef751ac Mon Sep 17 00:00:00 2001 From: cdez Date: Tue, 20 Sep 2022 11:50:30 -0700 Subject: [PATCH] Update Project_3.c +- Modified Spacing, made sure lines don't go above 80 characters, and formatting is better. --- PA03-0921/Project_3.c | 59 ++++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 17 deletions(-) diff --git a/PA03-0921/Project_3.c b/PA03-0921/Project_3.c index 644f7c1..e8297e3 100644 --- a/PA03-0921/Project_3.c +++ b/PA03-0921/Project_3.c @@ -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 -