Click here to Skip to main content
15,916,293 members
Home / Discussions / Java
   

Java

 
AnswerRe: books examples of precedures stored for sqlserver Pin
Richard MacCutchan9-Mar-20 22:25
mveRichard MacCutchan9-Mar-20 22:25 
AnswerRe: books examples of precedures stored for sqlserver Pin
ZurdoDev12-Mar-20 11:03
professionalZurdoDev12-Mar-20 11:03 
QuestionPLEASE HELP JAVA Pin
Member 147599401-Mar-20 14:19
Member 147599401-Mar-20 14:19 
AnswerRe: PLEASE HELP JAVA Pin
Richard MacCutchan1-Mar-20 21:36
mveRichard MacCutchan1-Mar-20 21:36 
AnswerRe: PLEASE HELP JAVA Pin
Richard MacCutchan1-Mar-20 21:42
mveRichard MacCutchan1-Mar-20 21:42 
GeneralRe: PLEASE HELP JAVA Pin
Member 1477360615-Mar-20 10:11
Member 1477360615-Mar-20 10:11 
GeneralRe: PLEASE HELP JAVA Pin
Richard MacCutchan15-Mar-20 12:26
mveRichard MacCutchan15-Mar-20 12:26 
AnswerRe: PLEASE HELP JAVA Pin
MallardsReach13-Mar-20 3:12
MallardsReach13-Mar-20 3:12 
Here's what I came up with not sating it's the correct way as I am only just starting with Java but it works.
Java
import java.util.Random;

public class TwoDiceGame {
    public static void main(String[] args){
        // Declare a counter variable to count the loop time
        int count = 0, total = 0;
        
        for(int i=0;i<100;i++){
           Random rNums = new Random(); // create a new object of Random class
            int rNums_die1 = rNums.nextInt(6)+1; 
            int rNums_die2 = rNums.nextInt(6)+1;
			
            if(rNums_die1 + rNums_die2 >= 10){
				total ++;
		         count ++;
			}
			else{
				 count++;
			}
		}
		System.out.println ("Out of 100 rolls of the two dice, the total of both the dice greater than or equal to 10 was " + total + " times");
    }
  }

GeneralRe: PLEASE HELP JAVA Pin
Richard MacCutchan13-Mar-20 4:30
mveRichard MacCutchan13-Mar-20 4:30 
GeneralRe: PLEASE HELP JAVA Pin
MallardsReach13-Mar-20 6:33
MallardsReach13-Mar-20 6:33 
GeneralRe: PLEASE HELP JAVA Pin
Richard MacCutchan13-Mar-20 6:49
mveRichard MacCutchan13-Mar-20 6:49 
GeneralRe: PLEASE HELP JAVA Pin
MallardsReach13-Mar-20 7:15
MallardsReach13-Mar-20 7:15 
QuestionTransfer data from SQL database to populate spinner Pin
Member 1475169121-Feb-20 5:55
Member 1475169121-Feb-20 5:55 
AnswerRe: Transfer data from SQL database to populate spinner Pin
Richard MacCutchan21-Feb-20 6:10
mveRichard MacCutchan21-Feb-20 6:10 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Member 1475169121-Feb-20 7:38
Member 1475169121-Feb-20 7:38 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Richard MacCutchan21-Feb-20 22:08
mveRichard MacCutchan21-Feb-20 22:08 
GeneralRe: Transfer data from SQL database to populate spinner Pin
Member 1475169122-Feb-20 14:38
Member 1475169122-Feb-20 14:38 
QuestionJson Manager Project (Need Critique/Possible Tips) Pin
Member 147385357-Feb-20 16:20
Member 147385357-Feb-20 16:20 
AnswerRe: Json Manager Project (Need Critique/Possible Tips) Pin
Richard MacCutchan7-Feb-20 22:06
mveRichard MacCutchan7-Feb-20 22:06 
GeneralRe: Json Manager Project (Need Critique/Possible Tips) Pin
Member 147385358-Feb-20 3:56
Member 147385358-Feb-20 3:56 
QuestionHow to optimize the time complexity of counting a word Pin
neelayak7-Feb-20 3:28
neelayak7-Feb-20 3:28 
AnswerRe: How to optimize the time complexity of counting a word Pin
Richard MacCutchan7-Feb-20 4:08
mveRichard MacCutchan7-Feb-20 4:08 
GeneralRe: How to optimize the time complexity of counting a word Pin
neelayak7-Feb-20 4:21
neelayak7-Feb-20 4:21 
GeneralRe: How to optimize the time complexity of counting a word Pin
Richard MacCutchan7-Feb-20 4:41
mveRichard MacCutchan7-Feb-20 4:41 
QuestionMessage Closed Pin
20-Jan-20 14:21
bekagaw65320-Jan-20 14:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.