An elementary calculation yields the result

Assignment Help JAVA Programming
Reference no: EM13161446

An elementary calculation yields the result that theoretically, the probability of turning up 7 when two dice are thrown is 1/6, or .166666. But what if more dice are thrown? If 3 dice are thrown, what is the probability that some 2 of three sum to 7? (Thus if 2-2-1 or 2-2-3 are thrown, no pair of dice sum to 7, so these combinations are failures, but if 2-3-4 or 2-3-5 or 1-2-5 are thrown, in each case a sum of 7 IS achievable with exactly 2 of the dice).


For this problem, you are to start with the driver below, which first prompts for the number of dice tossed - here, diceCount, and then runs a million experiments to determine the empirical likelihood that with that many dice rolled, some pair of the dice thrown sum to 7:

import java.util.Scanner;   
public class SevenDriver{       
  public static void main(String[] args){      
    System.out.println("Enter number of dice to toss");     
    Scanner s = new Scanner(System.in);      
    int diceCount = s.nextInt(); 
    SevenTally t = new SevenTally(diceCount);
    int experiments = 1000000;
    int wins = 0;
    for(int j = 0; j < experiments; j++)
      if(t.experiment()) wins++;
    System.out.println((double)wins/experiments);
        
  } 
}   

 

 

Reference no: EM13161446

Questions Cloud

State what are the partial pressures of no2 and n2o4 : N2O4 is introduced into an empty 2.14L container, what are the partial pressures of NO2 and N2O4 after equilibrium has been achieved at 45 degree celsius? Pn2o4, Pno2=?
Create a chart listing animals from the different classes : Create a chart listing animals from the different classes of vertebrates at the National Zoo. Include one example from each class. You should find information about the common characteristics of animals classified in this phylum. Describe their di..
Program that asks the user to enter up to 100 integer score : Write a C program that asks the user to enter up to 100 integer scores, which are to be stored in an array. (You should allow the user to terminate input prior to entering all 100 scores.) The program should then display all the scores, ten per line,..
Explain buret while the liquid sample is being transferred : What percentage error would be introduced in a 35.0 mL sample of liquid if the air bubble comes out of the tip of the buret while the liquid sample is being transferred?
An elementary calculation yields the result : An elementary calculation yields the result that theoretically, the probability of turning up 7 when two dice are thrown is 1/6, or .166666. But what if more dice are thrown? If 3 dice are thrown, what is the probability that some 2 of three sum to 7..
State mechanistic rationalization of the effect : Mechanistic rationalization of the effect of the chloro substituent on reactivity (B) Propose an additional experiment to test your mechanistic rationalization IV.
List all the elements that make up the human body : List all the elements that make up the human body. Answers must be in alphabetical order.
Which of the folloiwing is not true of agonistic behavior : which of the folloiwing is not true of agonistic behavior?
Name two examples of biotechnology : Name two examples of biotechnology that use recombinant DNA technology and two examples that do not.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write an interface for a bagadt that implements iterable

Write an interface for a BagADT that implements the Iterable interface. Include javadoc comments that will generate specifications for the BagADT so that someone who wants to implement this interface will know what each method does.

  Implement the finite field gf

Write a program called "GF2.java" to implement the finite field GF(p n )where p is a prime number andn is a positive integer.You also need to write four methodsto realize.

  Write java program to display results in java applet

Write down the java program which displays following results in java applet. Permits the user to enter three numbers (use JOptionPane for this) and prints out average of those value on screen.

  Write an interface for an abstract method

Write an interface, PointingDevice, containing:  an abstract method, getXCoord that returns an int and an abstract method, getYCoord that returns an int.

  Implement avl tree

Implement AVL trees that allows both iterative traversal and recursive traversal.

  Determine the decision of java

Determine the decision of Java as the platform to develop this program. Identify the Java-based technologies utilized in this project and analyze each of them. Then, provide discussion on the purpose of each of the Java-based technologies utiliz..

  Method named isallvowels that returns

Write a method named isAllVowels that returns whether a String consists entirely of vowels (a, e, i, o, or u, case-insensitively). If every character of the String is a vowel, your method should return true. If any character of the String is a non-vo..

  Web engineering principles

web application development, Web Engineering methodology, UML-based Web Engineering (UWE), models to the expansion of web applications, Object Oriented Web Solutions (OOWS),Web Modeling Language (WebML) methodology, Object-Oriented Hypermedia Design..

  Java program to declares integer array

Write a complete Java program to declares integer array, intArray, and initialize it to {1, 2, 3, 4, 5, 6, 7}.

  Write java program to select pine for furniture company

Write down the Java program for the furniture company. Ask user to select P for Pine, O for Oak or M for Mahogany.

  Method called wordlengths that accepts a scanner

Write a method called wordLengths that accepts a Scanner representing an input file as its argument. Your method should read from the given file.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd