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

  Record managing system application

Build a student record managing system application

  Program that initializes an array with ten random integers

Write a JAVA program that initializes an array with ten random integers and then prints four lines of output, containing

  Write a functions that takes an array of doubles

1. Write a function that is passed a single integer and then calculates the factorial of that number. A factorial is the product of the integer times all of the integers below it stopping at 1. So n!= n*(n-1)*(n-2).......3.2.1

  Uml exercise

UML Exercise: Automated Teller Machine (ATM),   1. To allow authorized card holders to make transactions,   Brief Summary of Requirements:

  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..

  Represent one book in java

Represent one book in java

  Write a recursive method to produce a pattern

Write a recursive method to produce a pattern of n lines of asterisks.

  Cascading style sheet to a website

Compare and contrast the process of adding JavaScript and a Cascading Style Sheet to a Website. Determine if they can be used simultaneously in a page.

  Hasanodddigit that returns whether any digit

d named hasAnOddDigit that returns whether any digit of a positive integer is odd. Your method should return true if the number has at least one odd digit and false if none of its digits are odd. 0, 2, 4, 6, and 8 are even digits, and 1, 3, 5, 7, 9 a..

  Design an abstract data type in java

Design an abstract data type in Java that represents a musical pitch

  Develop a reliable transfer protocol over udp

Develop a reliable transfer protocol over UDP. Focus on a Stop- and-Wait protocol.

  Write a java program to compute salary

Write a Java program which computes the Salary for a given number of employees. The program prompts user to enter n the number of employees.

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