Question: Step 2 : Implement the methods of the Card class Complete all methods of the Card class as described by the Javadoc comments. The class

Step 2: Implement the methods of the Card class
Complete all methods of the Card class as described by the Javadoc comments. The class contains both a suit and a rank. A suit is one of the categories into which the cards of a deck are divided. The rank is the relative importance of the card within its suit.
Note that the Card constructor must convert any rank and suit letters to uppercase.
For the equals() method, be sure to follow the steps outlined in Lesson 4. If you did not learn how to implement the compareTo() method in your prior course,7 public class Card implements Comparable Card
private String rank;
private String suit;
??****
Constructor for the Card class
@param rank the rank of card from 2 to A
@param suit the suit of card C, D, H, or S
*/
public (ard(String rank, String suit){
this.rank = rank;
this. suit = suit;
}
??****
Returns the card's rank
@return rank a rank from 2(low) to A (high)
*/
public String getRank(){
return rank;
}
??****
Returns the card's suit
@return C, D, H, or S
*/
public String getSuit(){
return suit;
}
??****
Updates the card's rank
@param rank a new rank
*/
public void setRank(String rank){
}
??****
Updates the card's suit
@param suit the new suit
*/
public void setSuit(String suit){
}
??****
Concatenates rank and suit
@return card rank and suit
*/
@override public String toString(){
return "";
}
/**
Overrides the equals method for Card
Compares rank and suit and
* follows the equals formula given in
* Lesson 4 and also in Joshua Block's text
* @param obj another Object to compare for
* equality
* @return whether obj is a Card and, if so,
* of equal rank and suit
*/
@Override public boolean equals(Object obj){
return false;
}
/**
* Orders two cards first by suit (alphabetically)
* Next by rank. "A" is considered the high card
* Order goes 2,3,4,5,6,7,8,9,10, J, Q, K, A
* @param card another Card to compare to this Card
* @return a negative number if this comes before c
* and a positive number if c comes before this
* and 0 if this and c are equal according to the above
* equals method
*/
@Override public int compareTo(Card card){
return -1;
}
}
}
 Step 2: Implement the methods of the Card class Complete all

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!