I am trying to make a program for a dice game where three dice are rolled in the game. Each ‘die’ has numbers from ‘1’ to ‘6’ on their sides.If the numbers are all 6, the user gets 500 points. If two numbers match, but not three, the user gets 50 points. If the user has two 6s (but not three 6s), then he/she gets 100 points. If no numbers match, then the user loses one point.
So far I have this:
import java.util.Random;
public class diceGame {
public static void main (String args[])
{
Random randomGenerator = new Random ();
int a;//first face of die
a = randomGenerator.nextInt((5)+1);
System.out.println(a);
int b;//second face of die
b = randomGenerator.nextInt((5)+1);
Random randomGenerator2 = new Random ();
System.out.println(b);
int c;//third face of die
c = randomGenerator.nextInt((5)+1);
Random randomGenerator3 = new Random ();
System.out.println(c);
But as soon as I get into the nested if statements I get stuck.Please help.
Aucun commentaire:
Enregistrer un commentaire