Modified Homework 3, Excluded Binary Files from GitUpload
++ Homework 3 Project Files +- GitIgnore Binary Files
This commit is contained in:
parent
5f4079b493
commit
d331ebfeaa
2 changed files with 46 additions and 16 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -1,2 +1,3 @@
|
||||||
# exclude .exe files from being tracked.
|
# exclude .exe files from being tracked.
|
||||||
*.exe
|
*.exe
|
||||||
|
PA03-0921/Project_3_PRG
|
||||||
|
|
|
||||||
|
|
@ -39,10 +39,12 @@ 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;
|
||||||
|
|
@ -54,10 +56,37 @@ int main()
|
||||||
// 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
|
||||||
|
|
@ -117,11 +146,11 @@ int main()
|
||||||
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 );
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue