When I test the Card class, I found out that the function of return card value always return the wrong result. Example 1: When I new a Card object of card value Diamond-3, I expect the return value function will give me "D3". However, it returns "00". Example 2: When I new a Card object of card value Diamond-3, I expect the return value function will give me "C5". However, it returns "12". Example 3: When I new a Card object of card value Diamond-3, I expect the return value function will give me "H8". However, it returns "25". Example 4: When I new a Card object of card value Diamond-3, I expect the return value function will give me "SQ". However, it returns "39".
I estimate it is related to the way how the program get the card suit and card digit value. From my observation, I can see that the pattern of all wrong results are the same. We can either change the way of getting the card suit and card digit value, or create alternative getter to make sure it will convert the value to the information we want.
Yes, all of us agree that the problem should be in the way getting card suit and card digit value. However, we do not recommend to change the original getters as they will be called by another class to perform combination comparing and history storing.
Okay, then I create two new getters specifically for displaying the card information. My revised code here, please help me double check if it is correct: public String printCardSymbol() { return Character.toString(CARD_SUIT[suit]) + CARD_VALUE[value]; }
Double checked and it works well.