Modified Homework 3, Excluded Binary Files from GitUpload

++ Homework 3 Project Files
+- GitIgnore Binary Files
This commit is contained in:
Charles Descamps 2022-09-20 10:49:12 -07:00
parent 5f4079b493
commit d331ebfeaa
2 changed files with 46 additions and 16 deletions

View file

@ -3,11 +3,11 @@
// global constants
// Minimum Arizona Tax, %
const double MIN_AZ_TAX = 2.59;
const double MIN_AZ_TAX = 2.59;
// Maximum Arizona Tax, %
const double MAX_AZ_TAX = 4.50;
// Minimum Federal Tax, %
const double MIN_FED_TAX = 10.00;
const double MIN_FED_TAX = 10.00;
// Maximum Federal Tax, %
const double MAX_FED_TAX = 37.00;
// SSN Tax, %
@ -39,26 +39,55 @@ const char SPACE_PIPE[] = " |";
// main program
int main()
{
// TODO: Write program as specified
// show title
// function: printString, printEndline(s)
printString("Dummy Tax Calculator");
printEndline();
printString(TOP_LINE);
printEndlines(2);
// initialize variables/functions
double totalIncome, contributionToIRA, adjustedIncome;
double minTaxFederal, maxTaxFederal, minTaxArizona, maxTaxArizona;
double taxSSN, taxMC, minTaxTotal, maxTaxTotal;
double maxIncome, minIncome;
double minEffectiveTax, maxEffectiveTax;
// get user input
// section title
printString( "Please provide your information below.\n" );
totalIncome = promptForInteger("Total Income $: ");
contributionToIRA = promptForInteger("Your IRA Contributions $: ");
// conduct computations
// show results
// totalIncome is user input
// 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
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
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
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
maxTaxArizona = MAX_AZ_TAX * 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
taxMC = TAX_MC * PERCENTAGE_CONVERSION * adjustedIncome;
// 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
maxTaxTotal = maxTaxFederal + maxTaxArizona + taxSSN + taxMC;
// 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
minIncome = totalIncome - maxTaxTotal;
// 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
maxEffectiveTax = (maxTaxTotal / totalIncome) / PERCENTAGE_CONVERSION;
// display results
// print top line
// function: printString, printEndline
@ -78,7 +107,7 @@ int main()
// function: printString, printEndline
printString( THICK_LINE_DIVIDER );
printEndline();
// print sub title line
// function: printStringJustified, printString, printCharacter,
// printEndline
@ -115,13 +144,13 @@ int main()
// print thin divider line
// function: printString, printEndline
printString( THIN_LINE_DIVIDER );
printEndline();
printEndline();
// Total tax payed
// Total tax paid
// function: printStringJustified, printString, printCharacter,
// printEndline
printString( PIPE_SPACE );
printStringJustified( "Tax To Be Payed ", DATA_NAME_WIDTH - 1, "LEFT" );
printStringJustified( "Tax To Be Paid ", DATA_NAME_WIDTH - 1, "LEFT" );
printCharacter( PIPE );
printStringJustified( "$", UNIT_WIDTH, "CENTER" );
printCharacter( PIPE );
@ -146,12 +175,12 @@ int main()
printDoubleJustified( maxIncome, PRECISION, VALUE_WIDTH - 1, "RIGHT" );
printString( SPACE_PIPE );
printEndline();
// print thick divider line
// function: printString, printEndline
printString( THICK_LINE_DIVIDER );
printEndline();
// end program / return program success
return 0;
}