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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  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.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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