Good evening, I am trying to code a rolling dice game. As of right now, I am just trying to figure out how to roll two dice randomly at a time. Here is my code so far
I am not sure how to return the sum of the two dice, or if I am even supposed to do it that way. Any help would be appreciated!
import java.util.Random;
public class TwentyOne{
public static void main(String[] args) {
int dice1;
int dice2;
welcome();
rollingDice(int dice1,int dice2);
}
public static void welcome() {
System.out.println("Welcome to the game of Twenty-One! FEELING LUCKY?! goodluck!");
}
public static int rollingDice(int dice1, int dice2) {
dice1 = (int)(Math.random()*6 + 1);
dice2 = (int)(Math.random()*6 + 1);
int sum = dice1 + dice2;
return sum;
}
}