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

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
# exclude .exe files from being tracked. # exclude .exe files from being tracked.
*.exe *.exe
PA03-0921/Project_3_PRG

View file

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