Advertisement
yusufmukharom

card.java rand card

Oct 23rd, 2019
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. public class Card {
  2. private int number, colors;
  3.  
  4. private static String[] Colors = { "Hearts", "Spades", "Diamonds", "Clubs" };
  5. private static String[] Number = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Knave", "Queen", "King" };
  6.  
  7. Card(int Cardcolors, int Cardnumber){
  8. this.number=Cardnumber;
  9. this.colors=Cardcolors;
  10. }
  11.  
  12. public @Override String toString(){
  13. return Number[number] + " of " + Colors[colors];
  14. }
  15.  
  16. public int getRank() {
  17. return number;
  18. }
  19.  
  20. public int getSuit() {
  21. return colors;
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement