Bug 515

Summary: Card value displayed inproperly
Product: 2021A-CS3343-Gp17-Big2PokerGame Reporter: CHAN Tsz Yin <tychan423-c>
Component: CardAssignee: Chung Ka Shing <kaschung4-c>
Status: RESOLVED FIXED    
Severity: normal CC: hwchan58-c, kaschung4-c, waisumpo2-c, yuctam4-c, yuenchong9-c
Priority: High    
Version: 1.0   
Hardware: PC   
OS: Windows   
Deadline: 2020-12-04   

Description CHAN Tsz Yin 2020-12-04 11:05:15 HKT
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".
Comment 1 CHAN Tsz Yin 2020-12-04 11:13:42 HKT
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.
Comment 2 CHAN Tsz Yin 2020-12-04 11:16:24 HKT
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.
Comment 3 CHAN Tsz Yin 2020-12-04 11:20:42 HKT
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];
    }
Comment 4 CHAN Tsz Yin 2020-12-04 11:21:21 HKT
Double checked and it works well.