ผลต่างระหว่างรุ่นของ "01219343/unit/poker"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) |
Jittat (คุย | มีส่วนร่วม) |
||
แถว 1: | แถว 1: | ||
+ | Follow the TDD steps to write these classes. | ||
+ | |||
== Card == | == Card == | ||
− | + | A card has a rank (A,1,...,9,10,J,Q,K) and a suit (S,H,D,C) (see [https://en.wikipedia.org/wiki/Suit_%28cards%29 suit]). | |
+ | |||
+ | Implement class <code>Card</code> that supports the following methods: | ||
+ | |||
+ | * Construction with rank and suit as strings. For example: | ||
+ | |||
+ | Card card = new Card('10','S'); | ||
− | * hasSameRank | + | * Getters: <code>getRank</code> and <code>getSuit</code> |
− | * hasSameSuit | + | * <code>hasSameRank</code> |
− | * | + | * <code>hasSameSuit</code> |
+ | * implements <code>Comparable<Card></code> | ||
== Hand == | == Hand == | ||
Use [https://en.wikipedia.org/wiki/List_of_poker_hands|this reference of poker hands] from wikipedia. | Use [https://en.wikipedia.org/wiki/List_of_poker_hands|this reference of poker hands] from wikipedia. |
รุ่นแก้ไขเมื่อ 16:03, 24 มกราคม 2556
Follow the TDD steps to write these classes.
Card
A card has a rank (A,1,...,9,10,J,Q,K) and a suit (S,H,D,C) (see suit).
Implement class Card
that supports the following methods:
- Construction with rank and suit as strings. For example:
Card card = new Card('10','S');
- Getters:
getRank
andgetSuit
hasSameRank
hasSameSuit
- implements
Comparable<Card>
Hand
Use reference of poker hands from wikipedia.