From CourseWiki
/** * Created by dturnbull on 4/3/17. */ public class Card { //data members private int rank; private String suit; /** * Create a Card Object for a given rank and suit * @param r * @param s */ public Card(int r, String s){ this.rank = r; this.suit = s; } public String toString(){ String output; if (this.rank <= 10 ){ output = this.rank +" of "+this.suit; } else if (this.rank == 11){ output = "Jack of "+this.suit; } else if (this.rank == 12){ output = "Queen of "+this.suit; } else if (this.rank == 13){ output = "King of "+this.suit; } else { output = "Ace of "+this.suit; } return output; } public static void main(String[] args) { Card c = new Card(12, "Spades"); Card c2 = new Card(2, "Diamonds"); System.out.println(c); } }