Enum Class
public enum Suit {
CLUB(0, "Clubs"),
DIAMOND(1, "Diamonds"),
HEART(2, "Hearts"),
SPADE(3, "Spades");}
private Suit(int sNum, String sName){
setsuitNumber(sNum);
setsuitName(sName);
public String num2suit(String suitName, int suitNumber){
return String.format("%s",suitName, suitNumber);}
public static String getSuitName() {
return suitName;}
static void setsuitName(String suitName) {
Suit.suitName = suitName;}
static void setRandomSuit(Suit[] x) {
Suit.suitName = suitName;
Suit.suitNumber = suitNumber;}
//This is where I "think" I should pass the Suit. CLUB.values() to
Game Class - basically where I try to generate a random number between 0 and 3 to generate a suit of a card (I have another method to generate a rank not pictured but same logic).
public static Suit[] randomSuit(){
Suit[] x = null;
int randomSuit = (int )(Math.random() * 3 + 1);
switch (randomSuit){
case 0:
x = Suit.CLUB.values(); //not sure what to do here to pass CLUB values
break; to get/set methods
case 1:
x = Suit.HEART.values();
break;
...
return x;}}
Card Class to generate a card.
public void setSuit(Suit suit) {
this.suit = suit;}
public Suit getSuit() {
return suit;}
public static String getName(){
return Rank.getRankName() + " of " + Suit.getSuitName();}
Tester
public static void main(String[] args){
Game.randomSuit();
System.out.println(Suit.getSuitName()); //Literally just trying to see if it
//even passed the values of the
//Suit.CLUB enum to the method
//(it didn't)
Sorry for the noob question, our professor is a temporary "step-in" who's never used Java before, and thus can't answer almost anything, so I must rely on StackOverflow and YouTube to teach myself. I appreciate any feedback.