ผลต่างระหว่างรุ่นของ "01219343/unit/poker"

จาก Theory Wiki
ไปยังการนำทาง ไปยังการค้นหา
แถว 7: แถว 7:
 
Implement class <code>Card</code> that supports the following methods:
 
Implement class <code>Card</code> that supports the following methods:
  
* Construction with rank and suit as strings. For example:
+
* Construction with rank and suit as strings. (This might not be an efficient way to represent ranks and suits, but it simplifies the exercise.)  For example:
  
  Card card = new Card('10','S');
+
  Card card = new Card("10","S");
  
 
* Getters: <code>getRank</code> and <code>getSuit</code>
 
* Getters: <code>getRank</code> and <code>getSuit</code>

รุ่นแก้ไขเมื่อ 16:06, 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. (This might not be an efficient way to represent ranks and suits, but it simplifies the exercise.) For example:
Card card = new Card("10","S");
  • Getters: getRank and getSuit
  • hasSameRank
  • hasSameSuit
  • implements Comparable<Card>

Hand

Use reference of poker hands from wikipedia.