UPDATED: 4/28/2021 by Brian Sabotta
Author: Brian Sabotta Created: 11/1/2019 Purpose: Code Test for SoftWriters Tools Used: Visual Studio 2017 + Resharper (for easy refactoring) .NET Info: C# 7.0 + .NET 4.6.1
As per the specifications of the code test, the application will take an input file, process all the lines, and write out to an output file.
The input and output files are passed via command line in the following manner:
CashRegisterSabotta.exe [input file path] [output file path]
Default paths have been set in the solution for ..\..\..\inputFile.txt and ..\..\..\outputFile.txt, but these can be altered to suit testing.
If any errors occur during the operation of the program through a command window, error information will be printed to the console for easy debugging. If errors occur while debugging in Visual Studio, error information will be printed to the output window for easy debugging.
Based on the example data given, the following choices were made:
-
an empty space will exist between every line in the output file.
-
transactions that require no change will be represented by empty lines in the output file (since 0 coin counts are excluded from output)
-
transactions containing garbage data will be represented by empty lines in the output file
-
processing of garbage files (that do not contain any valid data) will generate an output file of empty lines
=================================
Creative Cash Draw Solutions is a client who wants to provide something different for the cashiers who use their system. The function of the application is to tell the cashier how much change is owed and what denominations should be used. In most cases the app should return the minimum amount of physical change, but the client would like to add a twist. If the total due in cents is divisible by 3, the app should randomly generate the change denominations (but the math still needs to be right :))
Please write a program which accomplishes the clients goals. The program should:
- Accept a flat file as input
- Each line will contain the total due and the amount paid separated by a comma (for example: 2.13,3.00)
- Expect that there will be multiple lines
- Output the change the cashier should return to the customer
- The return string should look like: 1 dollar,2 quarters,1 nickel, etc ...
- Each new line in the input file should be a new line in the output file
2.12,3.00
1.97,2.00
3.33,5.00
3 quarters,1 dime,3 pennies
3 pennies
1 dollar,1 quarter,6 nickels,12 pennies
*Remember the last one is random
Please use whatever techniques you feel are applicable to solve the problem. We suggest that you approach this exercise as if this code was part of a larger system. The end result should be representative of your abilities and style. We prefer that you submit your solution in a language targeting the .NET Framework to help us better evaluate your code.
Please fork this repository. If your solution involves code auto generated by a development tool, please commit it separately from your own work. When you have completed your solution, please issue a pull request to notify us that you are ready.
Have fun.