I have 2 class files. One has the get/set statements and I need to write the code to use these get/set statements on another class file in the same project. How can I do that?
Also, I want 2 random numbers as an output but I get only 1.
Card class:
public class Card{
//variables
public int spades = 0;
public int hearts = 1;
public int diamonds = 2;
public int clubs = 3;
public int ace = 1;
public int jack = 11;
public int queen = 12;
public int king = 13;
private String rank;
private String suit;
//set methods
public void setSpades(String s){
spades = 0;
}
public void setHearts(int h){
hearts = 1;
}
public void setDiamonds(int d){
diamonds = 2;
}
public void setClubs(int c){
clubs = 3;
}
//get methods
public int getSpades(){
return spades;
}
public int getHearts(){
return hearts;
}
public int getDiamonds(){
return diamonds;
}
public int getClubs(){
return clubs;
}
public String getSuit() {
return suit;
}
public void setSuit(String suit) {
this.suit = suit;
}
public String getRank() {
return rank;
}
public void setRank(String rank) {
this.rank = rank;
}
}//end class
The second file:
public class PickTwoCards {
public static void main(String[] args){
Card Object = new Card();
Card Object2 = new Card();
int ranSuit = (int)(Math.random()*10);
System.out.println(ranSuit);
}
public void Card (int theValue, int theSuit, int suit, int value){
value = theValue;
suit= theSuit;
}
}//End class PickTwocCards