Add oving3
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
package oving3.card;
|
||||
|
||||
/**
|
||||
* The {@code Card} class is a so-called value-based class, which is coded in
|
||||
* such a way that its
|
||||
* objects cannot be modified after they are created. A {@code Card} object has
|
||||
* a suit and a face.
|
||||
*/
|
||||
public class Card {
|
||||
|
||||
// TODO: Add fields here
|
||||
|
||||
/**
|
||||
* The constructor of the {@code Card} class initializes the suit and face of
|
||||
* the card with the
|
||||
* first and second arguments, respectively.
|
||||
*
|
||||
* @param suit the suit of the card, one of {@code 'S'} (spades), {@code 'H'}
|
||||
* (hearts),
|
||||
* {@code 'D'} (diamonds), or {@code 'C'} (clubs)
|
||||
* @param face the face of the card, an integer between {@code 1} (ace) and
|
||||
* {@code 13} (king)
|
||||
* (both inclusive)
|
||||
* @throws IllegalArgumentException if the suit or face is illegal
|
||||
*
|
||||
* @see CardTest#testConstructor()
|
||||
*/
|
||||
public Card(char suit, int face) {
|
||||
// TODO: Implement this constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suit of the card
|
||||
*/
|
||||
public char getSuit() {
|
||||
// TODO: Implement this method
|
||||
return '\0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the face of the card
|
||||
*/
|
||||
public int getFace() {
|
||||
// TODO: Implement this method
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the value of the card of the form {@code <suit><face>}. For example,
|
||||
* the ace of
|
||||
* spades should return {@code "S1"}
|
||||
*
|
||||
* @see CardTest#testToString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
// TODO: Implement this method
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user