I am confused on how to begin this i have to find a way to read an input file and replace the string and write it to an output file (OUT). The input file (IN) is a deck of cards
- IN: 2-H
- OUT: Two of hearts (value = 2)
- IN: 1-C
- OUT: Invalid card rank in 1-C
- IN: 7*C
- OUT: Invalid delimiter in 7*C
- IN: X*Y
- OUT: Unrecognizable format in X*Y
- IN: A-C
- OUT: Ace of clubs (value=1 or value = 11)
- IN: Q-H
- OUT: Queen of hearts (value=10
I'd recommend test driving a function to do the mapping. The file reading/writing is trivial to look up.
Test driving leads to this:
Tests:
Class:
You need to just carry on adding tests to cover all the required functionality.