Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Netbeans Question.
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Candice Weatherman
Netbeans Question.
0 Answer(s)      3 years and 11 months ago
Posted in : Java Beginners


Ok here is my code-

*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.Random;
/**
*

*/
public class ContinueRollDie {

* @param args the command line arguments
*/
public static void main(String[] args) {
Random randomNumber = new Random();

int[][] frequency = new int[9][9];
int die1 = 0;
int die2 = 0;
for (int roll = 1; roll <= 64000; roll++) {
die1 = randomNumber.nextInt(8) + 1;
die2 = randomNumber.nextInt(8) + 1;
frequency[die1] [die2]++;
}
System.out.printf("%s%16s\n", " Sum", " Frequency");
for (int sum = 2; sum <= 12; sum++) {
System.out.printf("%4d%16d\n", sum, frequency[die1][die2]);


}


}

}

This is what I am trying to get my program to due- using a two-dimensional array to tally the actual combinations of rolls. A roll of 2 and 7 would be different than a roll of 7 and 2. The application should roll the dice 64,000 times. Display the results in a tabular format and determine if your results are reasonable.I am trying to get the application to tally the actual combination's of rolls possible within the array. I need 2 arrays.

Help plese!


Advertisement
View Answers

Related Tutorials/Questions & Answers:
Netbeans Question.
Netbeans Question.   Ok here is my code- * * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.Random; /** * */ public class ContinueRollDie { * @param args
Netbeans Question need help desperately!!
Netbeans Question need help desperately!!   Ok here is my code- public class RollDie2 { public static void main(String[] args) { Random randomNumber = new Random(); int[][] frequency = new int[9][9]; int die1 = 0; int
Advertisements
NetBeans
NetBeans  why Netbeans IDE is not commonly used Today by most of the companies
NetBeans
NetBeans  Hi, I am Kundan I have made a project on NetBeans. And now I want to know that how can i run my project without NetBeans IDE,on other PC. Please help me it's important
NetBeans
NetBeans  Hi, I am Kundan I have made a project on NetBeans. And now I want to know that how can i run my project without NetBeans IDE,on other PC. Please help me it's important
netbeans
netbeans  In netbeans, there are choices of books with their price. you check the book you wanted then click the purchase.the output should be the book with the price then you will get the total price of the book you purchase.how
netbeans
netbeans  guysss m nt able to opemn ma netbeans ide.. no error msg s coming... wn i installed yesterday one msg came stating about some run time error... sm one plzzzzzz hlp me
java netbeans
java netbeans  i am making project in core java using Netbeans. Regarding my project i want to know that How to fetch the data from ms-access... using netbeans
java netbeans
java netbeans  i am making project in core java using Netbeans. Regarding my project i want to know that How to fetch the data from ms-access... using netbeans
RMI and netbeans
RMI and netbeans  how to use Rmi in netbeans? i want to connect to a server machine which is holding my application and need to identify the systems connected in LAN with it and get the IP address from it i wnt to use netbeans
netbeans library
netbeans library  Hi could someone build a program in netbeans for a book library please.The program should provide a menu of options to work with the library, including: 1) Adding a new item to the library 2) Viewing all stock
netbeans library
netbeans library  Hi could someone build a program in netbeans for a book library please.The program should provide a menu of options to work with the library, including: 1) Adding a new item to the library 2) Viewing all stock
webservice in Netbeans
.. im using netbeans version 6.9.1 .. pls help me out... regards-- Harish Kumar
Netbeans program
Netbeans program  I need to write a program that does the following... The TicTacToe class contains a 3x3 two-dimensional array of integers... a two human player game of Tic-Tac-Toe. Using the NetBeans design tool also create
EJB with NetBeans
EJB with NetBeans  I am very new in Ejb and with very few knowledge about it. I have download NetBeans (7.01) and GlassFish (3.01). But, as I have no idea about Ejb, I am not getting how to run the code which includes a simple
netbeans program
netbeans program  Hi. could someone build this for me in netbeans please :) You are required to create a basic library management system for use with books. A Graphical User Interface (GUI) is not required, i.e. your program
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
Netbeans GUI Ribbon
Netbeans GUI Ribbon  how to create ribbon task in java GUI using netbeans
RMI in netbeans 6.5
RMI in netbeans 6.5  runing client in RMI using netbeans 6.5
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
JNDI names in netbeans
JNDI names in netbeans  how to create a JNDI names in netbeans
hibernate on netbeans - Hibernate
hibernate on netbeans  is it possible for me to run the hibernate program on Netbeans IDE
connect netbeans with oracle
connect netbeans with oracle  how to connect netbeans with oracle   Hi Friend, Please visit the following link: http://www.roseindia.net/jsf/visual-jsf.shtml Here you will find the steps to connect netbeans
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog
RMI Program in netbeans
RMI Program in netbeans  pls give me an idea for how to run RMI program in netbeans with detailed example
"The folder name is not valid" netbeans
"The folder name is not valid" netbeans  "The folder name is not valid" while crating a jsp,html or any page in netbeans
netbeans with mysql and tomcat
netbeans with mysql and tomcat  Hi. I have to run a JSP or JAVA file in netbeans with mysql database and tomcat server 7.0. But while the page loading itself it say error. ClassNotFoundException: com.mysql.jdbc.Driver. How
Advertisements
 

 

 

DMCA.com