From eb9e0e3afcf562c156551824ec9a87620b344783 Mon Sep 17 00:00:00 2001 From: cdez Date: Sun, 9 Oct 2022 13:50:32 -0700 Subject: [PATCH] Modified Project One, Added Project Five +- Project 1 Folder ++ Project 5 Folder/Files --- {PA01_0907 => PA01-0907}/Console_IO_Utility.c | 0 {PA01_0907 => PA01-0907}/Console_IO_Utility.h | 0 {PA01_0907 => PA01-0907}/Project_1.c | 0 {PA01_0907 => PA01-0907}/StandardConstants.h | 0 PA01_0907/PaymentCalc.exe | Bin 46540 -> 0 bytes PA05-1012/Console_IO_Utility.c | 590 ++++++++++++++++++ PA05-1012/Console_IO_Utility.h | 289 +++++++++ PA05-1012/Project_5.c | 194 ++++++ PA05-1012/StandardConstants.h | 48 ++ 9 files changed, 1121 insertions(+) rename {PA01_0907 => PA01-0907}/Console_IO_Utility.c (100%) rename {PA01_0907 => PA01-0907}/Console_IO_Utility.h (100%) rename {PA01_0907 => PA01-0907}/Project_1.c (100%) rename {PA01_0907 => PA01-0907}/StandardConstants.h (100%) delete mode 100644 PA01_0907/PaymentCalc.exe create mode 100644 PA05-1012/Console_IO_Utility.c create mode 100644 PA05-1012/Console_IO_Utility.h create mode 100644 PA05-1012/Project_5.c create mode 100644 PA05-1012/StandardConstants.h diff --git a/PA01_0907/Console_IO_Utility.c b/PA01-0907/Console_IO_Utility.c similarity index 100% rename from PA01_0907/Console_IO_Utility.c rename to PA01-0907/Console_IO_Utility.c diff --git a/PA01_0907/Console_IO_Utility.h b/PA01-0907/Console_IO_Utility.h similarity index 100% rename from PA01_0907/Console_IO_Utility.h rename to PA01-0907/Console_IO_Utility.h diff --git a/PA01_0907/Project_1.c b/PA01-0907/Project_1.c similarity index 100% rename from PA01_0907/Project_1.c rename to PA01-0907/Project_1.c diff --git a/PA01_0907/StandardConstants.h b/PA01-0907/StandardConstants.h similarity index 100% rename from PA01_0907/StandardConstants.h rename to PA01-0907/StandardConstants.h diff --git a/PA01_0907/PaymentCalc.exe b/PA01_0907/PaymentCalc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@k`CoLIEZ~@qaH^#T)@_zvwPj@r` diff --git a/PA05-1012/Console_IO_Utility.c b/PA05-1012/Console_IO_Utility.c new file mode 100644 index 0000000..38b9f46 --- /dev/null +++ b/PA05-1012/Console_IO_Utility.c @@ -0,0 +1,590 @@ +// Header files included +#include "Console_IO_Utility.h" + +// Function Implementations + +/* +Name: clearLeadingCharacters +Process: Clears all leading non-printable characters from the console stream +Function input/parameters: allow space return (Boolean) +Function output/parameters: none +Function output/returned: first printable character as integer +Device input/keyboard: none +Device output/monitor: none +Dependencies: getchar +*/ +int clearLeadingCharacters( bool allowSpaceReturn ) + { + // initialize data, set input character to getChar, set count to zero + // function: getchar + int intChar = getchar(); + int charCount = 0; + + // loop while non-printable characters and space if not set + // also limits looping to constant limit + while( ( intChar < (int)SPACE + || ( !allowSpaceReturn && intChar == SPACE ) ) + && charCount < MAX_STR_LEN ) + { + // update character count + charCount++; + + // get new input character + // function: getchar + intChar = getchar(); + } + + // return captured character + return intChar; + } + +/* + +Name: getChar +Process: returns next character in stream, + ignores all white space (including SPACE) prior to character +Function input/parameters: flag to accept space (Boolean) +Function output/parameters: none +Function output/returned: one character (char) is returned to calling method +Device input/keyboard: places one or more characters in stream +Device output/monitor: none +Dependencies: getCharFiltered +*/ +char getChar() + { + // initialize variables, set space accept flag to false + bool dontAcceptSpace = false; + + // call filtered function with space accept flag + // function: getCharFiltered + return getCharFiltered( dontAcceptSpace ); + } + +/* +Name: getCharFiltered +Process: returns next character in stream, + ignores non printable characters prior to input character + but may accept space depending on flag +Function input/parameters: flag to accept space (boolean) +Function output/parameters: none +Function output/returned: first printable character or space (if configured) + returned (char) +Device input/keyboard: places one or more characters in stream +Device output/monitor: none +Dependencies: getchar(), clearLeadingCharacters +*/ +char getCharFiltered( bool acceptSpace ) + { + //Initialize variables + int inCharInt; + + // clear leading characters, capture first usable character + // function: clearLeadingCharacters + inCharInt = clearLeadingCharacters( acceptSpace ); + + // check for input character set to end of file + if( inCharInt == EOF ) + { + // return character zero + return '0'; + } + + // return input character as character + return (char)inCharInt; + } + +/* +Name: getInputString +Process: acquires input string from keyboard, if clear white space flag set, + ignores all white space, including space character +Function input/parameters: clear white space control (Boolean) +Function output/parameters: character array (char[]) +Function output/returned: none +Device input/keyboard: user entry of a character stream +Device output/monitor: none +Dependencies: getchar(), clearLeadingCharacters +*/ +void getInputString( char inputArr[], bool clearWhiteSpace ) + { + //Initialize Variables, set character count and index to zero + int charCount = 0; + int index = 0; + int intChar; + + // check for clear white space flag + if( clearWhiteSpace ) + { + // clear leading characters, set flag to ignore space + // function: clearLeadingCharacters + intChar = clearLeadingCharacters( !clearWhiteSpace ); + } + + // otherwise, assume white space flag not set + else + { + // get first character + // function: getchar + intChar = getChar(); + } + + // loop until enter key found, limit loop to constant + while( intChar != (int)NEWLINE_CHAR && charCount < MAX_STR_LEN ) + { + // set current value to array element + inputArr[ index ] = (char)intChar; + + // increment string array index + index++; + + // add null character to end of string array + inputArr[ index ] = NULL_CHAR; + + // increment character count + charCount++; + + // get next character + // function: getchar + intChar = getchar(); + } + } + +/* +Name: printCharacter +Process: prints a single character +Function input/parameters: character to be printed (char) +Function output/parameters: None +Function output/returned: None +Device input/keyboard: None +Device output/monitor: character printed as specified +Dependencies: printCharacters +*/ +void printCharacter( char outputChar ) + { + // initialize number of characters to one + int numberOfChars = 1; + + // print one character + // function: printChars + printCharacters( numberOfChars, outputChar ); + } + +/* +Name: printCharacters +Process: prints given number of characters +Function input/parameters: number of characters (int), + character to be printed (char) +Function output/parameters: None +Function output/returned: None +Device input/keyboard: None +Device output/monitor: Number of specified characters printed +Dependencies: printf +*/ +void printCharacters( int numChars, char outputChar ) + { + // check for reminaing characters to print + if( numChars > 0 ) + { + // print one character + // function: printf + printf( "%c", outputChar ); + + // (recursive) print remaining characters + // function: printChars + printCharacters( numChars - 1, outputChar ); + } + } + +/* +Name: printDouble +Process: simple print double function +Function input/parameters: + outVal - the double value to be output (double) + precision - the number of digits to the right of the decimal point (int) +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: one double value displayed +Dependencies: printDoubleJustified +*/ +void printDouble( double outVal, int precision ) + { + // initialize variables, set block size to zero and justified to "LEFT" + int blockSize = 0; + char justified[] = "LEFT"; + + // call justified function with specified parameters + // function: printDoubleJustified + printDoubleJustified( outVal, precision, blockSize, justified ); + } + +/* +Name: printDoubleJustified +Process: the precision is set for the double value, then the pre-spaces + and post-spaces are calculated for the requested justification, + and then the pre-spaces are printed, the double value is printed, + and then the post-spaces are printed +Function input/parameters: + outVal - the double value to be output (double) + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: one double value displayed, justified, with precision +Dependencies: formatDouble, printStringJustified +*/ +void printDoubleJustified( double outVal, int precision, + int blockSize, const char* justify ) + { + // initialize variables, create temp string for configuration string + char specStr[ MIN_STR_LEN ]; + + // initialize variables, create temporary output string + char outStr[ MIN_STR_LEN ]; + + // set configuration string with precision value + // function: sprintf + sprintf( specStr, "%s0.%dlf", "%", precision ); + + // set output string + // function: sprintf + sprintf( outStr, specStr, outVal ); + + // print string justified + // function: printStringJustified + printStringJustified( outStr, blockSize, justify ); + } + +/* +Name: printEndline +Process: prints single endline character to end a line or create vertical space +Function input/parameters: none +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: one endline character output +Dependencies: printf +*/ +void printEndline() + { + // print one newline character + // function: printf + printf( "\n" ); + } + +/* +Name: printEndlines +Process: prints the specified number of endline characters + to end a line and/or create vertical space(s) +Function input/parameters: number of endlines (int) +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: endline characters output as specified +Dependencies: printEndline +*/ +void printEndlines( int numEndlines ) + { + // check for number of end lines remaining + if( numEndlines > 0 ) + { + // print one endling + // function: printEndline + printEndline(); + + // (recursive) print remaining end lines + printEndlines( numEndlines - 1 ); + } + } + +/* + Name: printInteger + Process: prints integer value +Function input/parameters: outVal - the integer value to be output + Output: None + Device Input: None + Device Output: Integer is displayed as specified + Dependencies: printIntegerJustified + */ +void printInteger( int outVal ) + { + // initialize variables, set block size to zero, justifification to "LEFT" + int blockSize = 0; + char justified[] = "LEFT"; + + // print justified integer with specified parameters + // function: printIntegerJustified + printIntegerJustified( outVal, blockSize, justified ); + } + +/* + Name: printIntegerJustified + Process: prints integer value with the specified justification + within the specified blockSize +Function input/parameters: + outVal - the integer value to be output + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) + Output: None + Device Input: None + Device Output: Integer is displayed as specified + Dependencies: sprintf, printStringJustified + */ +void printIntegerJustified( int outVal, int blockSize, const char *justify ) + { + // initialize variables, create temporary output string + char outStr[ MIN_STR_LEN ]; + + // convert integer to string + // function: sprintf + sprintf( outStr, "%d", outVal ); + + // print justified string + // function: printStringJustified + printStringJustified( outStr, blockSize, justify ); + } + +/* +Name: printLongInteger +Process: prints long integer +Function input/Parameters: outVal - the long integer value to be output +Function output/parameters: None +Function output/returned: None +Device Input/keyboard: None +Device Output/Monitor: integer is displayed as specified +Dependencies: printLongIntJustified +*/ +void printLongInteger( long outVal ) + { + // initialize variables, set block size to zero, justification to "LEFT" + int blockSize = 0; + char justified[] = "LEFT"; + + // print justified long integer with specified parameters + // function: printLongIntegerJustified + printLongIntegerJustified( outVal, blockSize, justified ); + } + +/* +Name: printLongIntegerJustified +Process: prints long integer with the specified justification + within the specified blockSize +Function input/Parameters: + outVal - the long integer value to be output + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) +Function output/parameters: None +Function output/returned: None +Device Input/keyboard: None +Device Output/Monitor: integer is displayed as specified +Dependencies: sprintf, printStringJustified +*/ +void printLongIntegerJustified( long outVal, + int blockSize, const char *justify ) + { + // initialize variables, create temporary output string + char outStr[ MIN_STR_LEN ]; + + // convert long integer to string + // function: sprintf + sprintf( outStr, "%ld", outVal ); + + // print justified string + // function: printStringJustified + printStringJustified( outStr, blockSize, justify ); + } + +/* + Name: printString + Process: prints string +Function input/parameters: outVal - the string value to be output +Function output/parameters: None +Function output/returned: None +Function input/keyboard: None +Device output/monitor: string is displayed as specified +Dependencies: printStringJustified +*/ +void printString( const char *outStr ) + { + // initialize variables, set block size to zero, justification to "LEFT" + int blockSize = 0; + char justified[] = "LEFT"; + + // print justified string with specified parameters + // function: printStringJustified + printStringJustified( outStr, blockSize, justified ); + } + +/* + Name: printStringJustified + Process: prints string within specified block size + and with specified justification +Function input/parameters: + outVal - the string value to be output + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) +Function output/parameters: None +Function output/returned: None +Function input/keyboard: None +Device output/monitor: string is displayed as specified +Dependencies: strlen, strcmp, printCharacters, printf +*/ +void printStringJustified ( const char *outStr, + int blockSize, const char *justify ) + { + // initialize variables, set pre-, post- spaces to zero + int preSpaces = 0, postSpaces = 0, strLength; + + // find length of string + // function: strlen + strLength = strlen( outStr ); + + // check justification for "LEFT" + // function: strcmp + if( strcmp( justify, "LEFT" ) == 0 ) + { + // set post spaces for left justification + postSpaces = blockSize - strLength; + } + + // otherwise, check justification for "RIGHT" + // function: strcmp + else if( strcmp( justify, "RIGHT" ) == 0 ) + { + // set pre spaces for right justification + preSpaces = blockSize - strLength; + } + + // Otherwise, assume "CENTER" justification + else + { + // set pre spaces for centered + preSpaces = blockSize / 2 - strLength / 2; + + // set post spaces for centered + postSpaces = blockSize - strLength - preSpaces; + } + + // print pre spaces + // function: printChars + printCharacters( preSpaces, SPACE ); + + // print string + // function: printf + printf( "%s", outStr ); + + // print post spaces + // function: printChars + printCharacters( postSpaces, SPACE ); + } + +/* +Name: promptForCharacter +Process: prompts user for character, then returns it +Function input/parameters: text to prompt user (c-string) +Function output/parameters: None +Function output/returned: one character (chars +Device input/keyboard: user entry of a character +Device output/monitor: prompt string displayed +Dependencies: printf, getChar +*/ +char promptForCharacter( const char *promptString ) + { + // initialize variables + char outChar; + + // print prompt string + // function: printf + printf( "%s", promptString ); + + // get character from stream + // function: getChar + outChar = (char)getChar(); + + // return captured character + return outChar; + } + +/* +Name: promptForDouble +Process: prompts user for double, then returns it +Function input/parameters: test to prompt user (c-string) +Function output/parameters: None +Function output/returned: value (double) +Device input/keyboard: user entry of an integer value +Device output/monitor: prompt string displayed +Dependencies: printf, scanf + */ +double promptForDouble( const char *promptString ) + { + // initialize variables + double outDouble; + + // print prompt string + // function: printf + printf( "%s", promptString ); + + // get double value + // function: scanf + scanf( "%lf", &outDouble ); + + // return captured double + return outDouble; + } + +/* +Name: promptForInteger +Process: prompts user for integer, then returns it +Function input/parameters: text to prompt user (c-string) +Function output/parameters: none +Function output/returned: integer value (int) +Device input/keyboard: user entry of a double value +Device output/monitor: prompt string displayed +Dependencies: printf, scanf +*/ +int promptForInteger( const char *promptString ) + { + // initialize variables + int outInt; + + // print prompt string + // function: printf + printf( "%s", promptString ); + + // input integer + // function: scanf + scanf( "%d", &outInt ); + + // return captured integer + return outInt; + } + +/* +Name: promptForString +Process: prompts user for string, then returns it +Function input/parameters: text to prompt user (c-string) +Function output/parameters: input string from user(c-string) +Function output/returned: none +Device input/keyboard: user entry of a string value +Device output/monitor: prompt string displayed +Dependencies: printf, getInputString +*/ +void promptForString( const char *promptString, char returnStr[] ) + { + // initialize variables, don't allow white space capture + bool dontClearWhitespace = false; + + // pring prompt string + // function: printf + printf( "%s", promptString ); + + // get input string from user (returned via parameter) + // function: getInputString + getInputString( returnStr, dontClearWhitespace ); + } + + diff --git a/PA05-1012/Console_IO_Utility.h b/PA05-1012/Console_IO_Utility.h new file mode 100644 index 0000000..23bb672 --- /dev/null +++ b/PA05-1012/Console_IO_Utility.h @@ -0,0 +1,289 @@ +// Preprocessor directive +#ifndef CONSOLE_IO_UTILITY_H +#define CONSOLE_IO_UTILITY_H + +//Header Files +#include +#include +#include +#include "StandardConstants.h" + +//Global Constants + + // none + +//Function Prototypes + +/* +Name: clearLeadingCharacters +Process: Clears all leading non-printable characters from the console stream +Function input/parameters: allow space return (bool) +Function output/parameters: none +Function output/returned: first printable character as integer +Device input/keyboard: none +Device output/monitor: none +Dependencies: getchar +*/ +int clearLeadingCharacters( bool allowSpaceReturn ); + +/* +Name: getChar +Process: returns next character in stream, + ignores all white space (including SPACE) prior to character +Function input/parameters: flag to accept space (bool) +Function output/parameters: none +Function output/returned: one character (char) is returned to calling method +Device input/keyboard: places one or more characters in stream +Device output/monitor: none +Dependencies: +*/ +char getChar(); + +/* +Name: getCharFiltered +Process: returns next character in stream, + ignores non printable characters prior to input character + but may accept space depending on flag +Function input/parameters: flag to accept space (bool) +Function output/parameters: none +Function output/returned: first printable character or space (if configured) + returned (char) +Device input/keyboard: places one or more characters in stream +Device output/monitor: none +Dependencies: getchar(), clearLeadingCharacters +*/ +char getCharFiltered( bool acceptSpace ); + +/* +Name: getInputString +Process: acquires input string from keyboard, if clear white space flag set, + ignores all white space, including space character +Function input/parameters: clear white space control (bool) +Function output/parameters: character array (char[]) +Function output/returned: none +Device input/keyboard: user entry of a character stream +Device output/monitor: none +Dependencies: getchar(), clearLeadingCharacters +*/ +void getInputString(char inputArr[], bool clearWhiteSpace ); + +/* +Name: printCharacter +Process: prints a single character +Function input/parameters: character to be printed (char) +Function output/parameters: None +Function output/returned: None +Device input/keyboard: None +Device output/monitor: character printed as specified +Dependencies: printCharacters +*/ +void printCharacter( char outputChar ); + +/* +Name: printCharacters +Process: prints given number of characters +Function input/parameters: number of characters (int), + character to be printed (char) +Function output/parameters: None +Function output/returned: None +Device input/keyboard: None +Device output/monitor: Number of specified characters printed +Dependencies: printf +*/ +void printCharacters( int numChars, char outputChar ); + +/* +Name: printDouble +Process: simple print double function +Function input/parameters: + outVal - the double value to be output (double) + precision - the number of digits to the right of the decimal point (int) +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: one double value displayed +Dependencies: printDoubleJustified +*/ +void printDouble( double outVal, int precision ); + +/* +Name: printDoubleJustified +Process: the precision is set for the double value, then the pre-spaces + and post-spaces are calculated for the requested justification, + and then the pre-spaces are printed, the double value is printed, + and then the post-spaces are printed +Function input/parameters: + outVal - the double value to be output (double) + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: one double value displayed, justified, with precision +Dependencies: formatDouble, printStringJustified +*/ +void printDoubleJustified( double outVal, int precision, + int blockSize, const char* justify ); + +/* +Name: printEndline +Process: prints single endline character to end a line or create vertical space +Function input/parameters: none +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: one endline character output +Dependencies: printEndline +*/ +void printEndline(); + +/* +Name: printEndlines +Process: prints the specified number of endline characters + to end a line and/or create vertical space(s) +Function input/parameters: number of endlines (int) +Function output/parameters: none +Function output/returned: none +Device input: none +Device output/monitor: endline characters output as specified +Dependencies: printEndline +*/ +void printEndlines( int numEndlines ); + +/* + Name: printInteger + Process: prints integer value +Function input/parameters: outVal - the integer value to be output + Output: None + Device Input: None + Device Output: Integer is displayed as specified + Dependencies: printIntegerJustified + */ +void printInteger( int outVal ); + +/* + Name: printIntegerJustified + Process: prints integer value with the specified justification + within the specified blockSize +Function output/parameters: + outVal - the integer value to be output (int) + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) + Output: None + Device Input: None + Device Output: Integer is displayed as specified + Dependencies: sprintf, printStringJustified + */ +void printIntegerJustified( int outVal, int blockSize, const char *justify ); + +/* +Name: printLongInteger +Process: prints long integer +Function input/Parameters: outVal - the long integer value to be output +Function output/parameters: None +Function output/returned: None +Device Input/keyboard: None +Device Output/Monitor: integer is displayed as specified +Dependencies: printLongIntJustified +*/ +void printLongInteger( long outVal ); + +/* +Name: printLongIntegerJustified +Process: prints long integer with the specified justification + within the specified blockSize +Function Input/Parameters: + outVal - the long integer value to be output (long int) + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) +Function output/parameters: None +Function output/returned: None +Device Input/keyboard: None +Device Output/Monitor: integer is displayed as specified +Dependencies: sprintf, printStringJustified +*/ +void printLongIntegerJustified( long outVal, + int blockSize, const char *justify ); + +/* + Name: printString + Process: prints string +Function input/parameters: outVal - the string value to be output +Function output/parameters: None +Function output/returned: None +Function input/keyboard: None +Device output/monitor: string is displayed as specified +Dependencies: printStringJustified +*/ +void printString( const char *outStr ); + +/* + Name: printStringJustified + Process: prints string within specified block size + and with specified justification +Function input/parameters: + outVal - the string value to be output (c-string) + blockSize - the width of the block within which + to print the integer value (int) + justify - "LEFT," "RIGHT," or "CENTER" justification in block (c-string) +Function output/parameters: None +Function output/returned: None +Function input/keyboard: None +Device output/monitor: string is displayed as specified +Dependencies: strlen, strcmp, printCharacters, printf +*/ +void printStringJustified( const char *outStr, + int blockSize, const char *justify ); + +/* +Name: promptForCharacter +Process: prompts user for character, then returns it +Function input/parameters: text to prompt user (c-string) +Function output/parameters: None +Function output/returned: one character (chars +Device input/keyboard: user entry of a character +Device output/monitor: prompt string displayed +Dependencies: printf, getChar +*/ +char promptForCharacter( const char *promptString ); + +/* +Name: promptForDouble +Process: prompts user for double, then returns it +Function input/parameters: test to prompt user (c-string) +Function output/parameters: None +Function output/returned: value (double) +Device input/keyboard: user entry of an integer value +Device output/monitor: prompt string displayed +Dependencies: printf, scanf + */ +double promptForDouble( const char *promptString ); + +/* +Name: promptForInteger +Process: prompts user for integer, then returns it +Function input/parameters: text to prompt user (c-string) +Function output/parameters: none +Function output/returned: integer value (int) +Device input/keyboard: user entry of a double value +Device output/monitor: prompt string displayed +Dependencies: printf, scanf +*/ +int promptForInteger( const char *promptString ); + +/* +Name: promptForString +Process: prompts user for string, then returns it +Function input/parameters: text to prompt user (c-string) +Function output/parameters: none +Function output/returned: input string (c-string) +Device input/keyboard: user entry of a string value +Device output/monitor: prompt string displayed +Dependencies: printf, getInputString +*/ +void promptForString( const char *promptString, char returnStr[] ); + +#endif // end CONSOLE_IO_UTILITY_H diff --git a/PA05-1012/Project_5.c b/PA05-1012/Project_5.c new file mode 100644 index 0000000..15a3b0a --- /dev/null +++ b/PA05-1012/Project_5.c @@ -0,0 +1,194 @@ +// header files +#include "Console_IO_Utility.h" + +// global constants + //AZ taxes + // AZ tax Baseline RATE +const double AZ_TAX_BASELINE_RATE = 0.0259; + // AZ tax Baseline LIMIT +const double AZ_TAX_BASELINE_LIMIT = 27808.5; + // AZ tax First bracket RATE +const double AZ_TAX_FIRST_BRACKET_RATE = 0.0334; + // AZ tax First bracket LIMIT +const double AZ_TAX_FIRST_BRACKET_LIMIT = 55615.5; + // AZ tax Second bracket RATE +const double AZ_TAX_SECOND_BRACKET_RATE = 0.0417; + // AZ tax Second bracket LIMIT +const double AZ_TAX_SECOND_BRACKET_LIMIT = 166843.5; + // AZ tax MAX bracket RATE +const double AZ_TAX_MAX_RATE = 0.045; + + // Federal taxes + // Minimum FED Tax RATE +const double FED_TAX_BASELINE_RATE = 0.1000; + // FED tax Baseline LIMIT +const double FED_TAX_BASELINE_LIMIT = 10275.5; + // FED tax First bracket RATE +const double FED_TAX_FIRST_BRACKET_RATE = 0.1200; + // FED tax First bracket LIMIT +const double FED_TAX_FIRST_BRACKET_LIMIT = 41775.5; + // FED tax Second bracket RATE +const double FED_TAX_SECOND_BRACKET_RATE = 0.2200; + // FED tax Second bracket LIMIT +const double FED_TAX_SECOND_BRACKET_LIMIT = 89075.5; + // FED tax Third bracket RATE +const double FED_TAX_THIRD_BRACKET_RATE = 0.2400; + // FED tax Third bracket LIMIT +const double FED_TAX_THIRD_BRACKET_LIMIT = 170050.5; + // FED tax Fourth bracket RATE +const double FED_TAX_FOURTH_BRACKET_RATE = 0.3200; + // FED tax Fourth bracket LIMIT +const double FED_TAX_FOURTH_BRACKET_LIMIT = 215950.5; + // FED tax Fifth bracket RATE +const double FED_TAX_FIFTH_BRACKET_RATE = 0.3500; + // FED tax Fifth bracket LIMIT +const double FED_TAX_FIFTH_BRACKET_LIMIT = 539900.5; + // AZ tax MAX bracket RATE +const double FED_TAX_MAX_RATE = 0.3700; + + // Other Taxes + // SSN Tax RATE +const double TAX_SSN = 0.0620; + // MC Tax RATE +const double TAX_MC = 0.0145; + + + // Percent Conversion, ratio +const double PERCENTAGE_CONVERSION = 100; + + // printing related constants +const int TWO_ENDLINES = 2; + // constants for table +const int TABLE_WIDTH = 46; +const int DATA_NAME_WIDTH = 20; +const int UNIT_WIDTH = 7; +const int VALUE_WIDTH = 15; +const char TOP_LINE[] + = "=============================================="; +const char THICK_LINE_DIVIDER[] + = "|============================================|"; +const char THIN_LINE_DIVIDER[] + = "|--------------------------------------------|"; +const char PIPE_SPACE[] = "| "; +const char SPACE_PIPE[] = " |"; + +// function prototypes +double calculateFederalTax( double adjustedIncome ); +double calculateArizonaTax( double adjustedIncome ); + +void displayResultsTable( double taxArizona, double taxFederal, + double incomeAfterTaxes, double effectiveTax, + double taxTotal, double incomeLocked); + +// main program +int main() + { + // TODO: Write program as specified + // show title + // function: printString, printEndline(s) + printEndline(); + printString( "Dummy tax calculator V0.3" ); + printEndline(); + printString( TOP_LINE ); + printEndlines( TWO_ENDLINES ); + + // initialize variables/functions + double totalIncome, contributionToIRA, adjustedIncome; + double taxFederal, taxArizona; + double taxSSN, taxMC, taxTotal; + double incomeAfterTaxes; + double effectiveTax, incomeLocked; + + // get user input + // section title + // function: printString, printEndline + printString( "Provide your Tax information below." ); + printEndline(); + + // total income $ + // function: promptForDouble + totalIncome = promptForDouble("Total income $: "); + + // IRA contributions $ + // function: promptForDouble + contributionToIRA = promptForDouble("Your IRA contributions $: "); + + // conduct computations + // adjust income by IRA contributions, $ + adjustedIncome = totalIncome - contributionToIRA; + + // calculate federal tax, $ + taxFederal = calculateFederalTax(adjustedIncome); + + // calculate AZ tax, $ + taxArizona = calculateArizonaTax(adjustedIncome); + + // calculate SSN tax, $ + taxSSN = adjustedIncome * TAX_SSN; + + // calculate MC tax, $ + taxMC = adjustedIncome * TAX_MC; + + // calculate Total tax to be payed, $ + taxTotal = taxFederal + taxArizona + taxSSN + taxMC; + + // calculate Income after Tax, $ + incomeAfterTaxes = totalIncome - taxTotal; + + // calculate effective tax rate, % + effectiveTax = taxTotal / totalIncome; + + // calculate % of income locked in IRA, % + incomeLocked = (contributionToIRA / totalIncome) * PERCENTAGE_CONVERSION; + + // display results + displayResultsTable( taxArizona, taxFederal, + incomeAfterTaxes, effectiveTax, + taxTotal, incomeLocked); + + // end program / return program success + return 0; + } + +// supporting functions + // TODO + + +/* +Name: calculateArizonaTax +Process: calculates total marginal Arizona tax based on adjusted income +Function Input/Parameters: adjustedIncome +Function Output/Parameters: none +Function Output/Returned: total arizona tax +Device Input/Keyboard: none +Device Output/Monitor: none +Dependencies: none +*/ + + +/* +Name: calculateFederalTax +Process: calculates total marginal federal tax based on adjusted income +Function Input/Parameters: adjustedIncome +Function Output/Parameters: none +Function Output/Returned: total federal tax +Device Input/Keyboard: none +Device Output/Monitor: none +Dependencies: none +*/ + + +/* +Name: displayResultsTable +Process: displays (prints) table for tax calculator V0.3 +Function Input/Parameters: income after tax, effective tax rate, + total tax to be payed, and locked income. +Function Output/Parameters: none +Function Output/Returned: none +Device Input/Keyboard: none +Device Output/Monitor: table as showed in example for PA05 +Dependencies: printEndline, printString, printCharacter, printStringJustified, + printDoubleJustified +*/ + + diff --git a/PA05-1012/StandardConstants.h b/PA05-1012/StandardConstants.h new file mode 100644 index 0000000..1ff95b4 --- /dev/null +++ b/PA05-1012/StandardConstants.h @@ -0,0 +1,48 @@ +// Preprocessor directives +#ifndef STANDARD_CONSTANTS_H +#define STANDARD_CONSTANTS_H + +// global constants + +// constant for end of c-string null character +#define CARRIAGE_RETURN_CHAR '\r' + +//constant for a COLON +#define COLON ':' + +//constant for a COMMA +#define COMMA ',' + +//Constant to print a dash +#define DASH '-' + +// constant for end of c-string null character +#define NEWLINE_CHAR '\n' + +// constant for small string length +#define MIN_STR_LEN 32 + +// constant for maximum string length +#define MAX_STR_LEN 128 + +// constant for end of c-string null character +#define NULL_CHAR '\0' + +//Constant for printing a pipe +#define PIPE '|' + +//Constant for a period +#define PERIOD '.' + +//Constant for PRECISION +#define PRECISION 3 + +// constant for space character +#define SPACE ' ' + +// constant for standard string length +#define STD_STR_LEN 64 + +#endif // STANDARD_CONSTANTS + +