14,332,266 members

# Java

 Re: counting hand fingers in an image Richard MacCutchan2-Jun-18 0:22 Richard MacCutchan 2-Jun-18 0:22
 how to start learning java Member 1383037827-May-18 23:23 Member 13830378 27-May-18 23:23
 Re: how to start learning java Richard MacCutchan28-May-18 22:16 Richard MacCutchan 28-May-18 22:16
 Need help choosing test API Member 1384132023-May-18 8:37 Member 13841320 23-May-18 8:37
 Re: Error in Integer mode Richard MacCutchan10-May-18 1:16 Richard MacCutchan 10-May-18 1:16
 Re: Error in Integer mode Richard Deeming10-May-18 1:26 Richard Deeming 10-May-18 1:26
 Re: Error in Integer mode Richard MacCutchan10-May-18 1:27 Richard MacCutchan 10-May-18 1:27
 Halp please? Dice roll game. Gril13376-May-18 7:01 Gril1337 6-May-18 7:01
 Hey guys! I'm just trying to figure out this homework and could use some help. Not looking for answers really, just a better understanding. I'm very very new to coding, using jGRASP java. The teacher told us to create this game that generates an output similar to this. Round 1: • Player A rolls: 1,2, the highest number is 21 • Player B rolls: 2,1, the highest number is 21 • Result: draw • Round 2: • Player A rolls: 2,5, the highest number is 52 • Player B rolls: 6,8 the highest number is 86 • Result: Player B wins • Round 3: • Player A rolls: 1,9, the highest number is 91 • Player B rolls: 9,9 the highest number is 99 • Result: Player B wins • Final Result: Player B wins!!! Do I have to declare the numbers as Strings to concatenate them? and do I use if else statements? Specifically, I'm confused on how to arrange the two numbers if one is greater than the other so the greater number will be placed in front. import java.util.Scanner; import java.util.Random; public class beatThat { public static void main(String[] args) { Random r1 = new Random(); Random r2 = new Random(); Random r3 = new Random(); Random r4 = new Random(); int die1 = r1.nextInt(6) + 1; int die2 = r2.nextInt(6) + 1; int die3 = r3.nextInt(6) + 1; int die4 = r4.nextInt(6) + 1; System.out.println("ROUND 1"); System.out.println("Player A rolls: " + die1 + " and " + die2 +"."); System.out.println("Player B rolls: " + die3 + " and " + die4 +"."); if(die1 >= die2) { System.out.println("Player A's highest number is: " + die1 + die2); } else if (die2 >= die1) { System.out.println("Player A's highest number is: " + die2 + die1); } if(die3 >= die4) { System.out.println("Player B's highest number is: " + die3 + die4); } else if(die4 >= die3) { System.out.println("Player B's highest number is: " + die4 + die3); } } } Anything helps, thank you guys. Have a good day!modified 6-May-18 14:51pm.
 Re: Halp please? Dice roll game. Richard MacCutchan6-May-18 21:52 Richard MacCutchan 6-May-18 21:52
 Solving symmetric tree problem by recursive solution ElenaRez6-May-18 6:52 ElenaRez 6-May-18 6:52
 Re: Solving symmetric tree problem by recursive solution Richard MacCutchan6-May-18 21:44 Richard MacCutchan 6-May-18 21:44
 Deep copy of List<> without knowing specific list type jackbrownii30-Apr-18 10:55 jackbrownii 30-Apr-18 10:55
 Re: Deep copy of List<> without knowing specific list type Manish K. Agarwal27-May-18 21:32 Manish K. Agarwal 27-May-18 21:32
 Student needing assistance while loop Victor McNeal21-Apr-18 9:15 Victor McNeal 21-Apr-18 9:15
 Re: Student needing assistance while loop Richard MacCutchan21-Apr-18 20:56 Richard MacCutchan 21-Apr-18 20:56
 Message Closed 9-Sep-19 23:31 Member 14585837 9-Sep-19 23:31
 Java JUnit test error CHUCHU YAO20-Apr-18 13:23 CHUCHU YAO 20-Apr-18 13:23
 Re: Java JUnit test error Richard MacCutchan20-Apr-18 20:43 Richard MacCutchan 20-Apr-18 20:43
 Re: Java JUnit test error jschell21-Apr-18 6:31 jschell 21-Apr-18 6:31
 Re: Java JUnit test error Richard MacCutchan21-Apr-18 20:58 Richard MacCutchan 21-Apr-18 20:58
 JAVA Swing GUI Invoice - problem with correct actionPerformed Member 1378720218-Apr-18 20:59 Member 13787202 18-Apr-18 20:59
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed Richard MacCutchan18-Apr-18 21:51 Richard MacCutchan 18-Apr-18 21:51
 Re: JAVA Swing GUI Invoice - problem with correct actionPerformed Member 1378720219-Apr-18 0:54 Member 13787202 19-Apr-18 0:54
 Last Visit: 20-Oct-19 7:59     Last Update: 20-Oct-19 7:59 Refresh « Prev1...12131415161718192021 Next »