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

  Difference between the two following statements

What exactly is the difference between the two following statements and which is preferred, please provide details: 1) frame.setSize(400, 300); // Set JFrame Size

  Create a bar chart that illustrates sales.

Hal's Used Cars has four salespeople named Pam, Leo, Kim, and Bob. Accept values for the number of cars sold by each salesperson in a month, and create a bar chart that illustrates sales. Save the file as BarGraph.java.

  Instance methods

instance methods: setWidth(double w), setHeight(double h), double getWidth(), double getHeight() and double getArea() * A triangle's area is calculated by width*height*0.5  * all variables are private and methods public.

  Program to find maximum-minimum of sequence of values

Common task which should be done in loop is to find maximum and minimum of sequence of values. File Temps.java contains program which reads in sequence of hourly temperature readings over 24- hour period.

  Write the bubble sort

The village of Marengo conducted a census and collected records that have household data, including the number of occupants in each household.

  Define private instance variable to hold boolean value

Write a Java Enumeration "LetterGrade" that represents letter grades A through F including plus and minus grades. Define a private instance variable to hold a boolean value.

  Write down java console application to add new student

Write down java console application presents the following menu. Add new student and scores in Biology, Physics and chemistry Search for a given student.

  Implement simple java program to input syllabus grades

To implement simple Java program to input (hypothetical) syllabus grades, computing and displaying both normal Mean and Harmonic Mean.

  Write a program that reads a set of floating-point

Write a program that reads a set of floating-point data values from the input.

  Design an abstract data type in java

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

  Give at least one constructor without any parameter

We learned as popular Set implementation. Write own TreeSet class that implements following interface: You are to give at least one constructor without any parameter.

  The objective is to implement a menu-based system

The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

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