1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
photoshop1234 [79]
4 years ago
8

The birthday paradox says that the probability that two people in a room will have the same birthday is more than half, provided

n, the number of people in the room, is more than 23. This property is not really a paradox, but many people find it surprising. Design a Java program that can test this paradox by a series of experiments on randomly generated birthdays, which test this paradox for n = 5, 10, 15, 20, ..., 100.
Computers and Technology
1 answer:
poizon [28]4 years ago
4 0

Answer:

The Java code is given below with appropriate comments for explanation

Explanation:

// java code to contradict birth day paradox

import java.util.Random;

public class BirthDayParadox

{

public static void main(String[] args)

{

   Random randNum = new Random();

   int people = 5;

   int[] birth_Day = new int[365+1];

   // setting up birthsdays

   for (int i = 0; i < birth_Day.length; i++)

       birth_Day[i] = i + 1;

 

   int iteration;

   // varying number n

   while (people <= 100)

   {

       System.out.println("Number of people: " + people);

       // creating new birth day array

       int[] newbirth_Day = new int[people];

       int count = 0;

       iteration = 100000;

       while(iteration != 0)

       {

           count = 0;

           for (int i = 0; i < newbirth_Day.length; i++)

           {

               // generating random birth day

               int day = randNum.nextInt(365);

               newbirth_Day[i] = birth_Day[day];

           }

           // check for same birthdays

           for (int i = 0; i < newbirth_Day.length; i++)

           {

               int bday = newbirth_Day[i];

               for (int j = i+1; j < newbirth_Day.length; j++)

               {

                   if (bday == newbirth_Day[j])

                   {

                       count++;

                       break;

                   }

               }

           }

           iteration = iteration - 1;

       }

       System.out.println("Probability: " + count + "/" + 100000);

       System.out.println();

       people += 5;

   }

}

}

You might be interested in
Write a program to insert student grade and print the following
tangare [24]

Answer:

The answer is the program, in the explanation

Explanation:

I am going to write a C program.

int main(){

int grade = -1; /*The grade will be read to this variable*/

/*This loop will keep repeating until a valid grade is inserted*/

while(grade < 0 || grade > 100){

         printf("Insert the student's grade: %n");

         scanf("%d", &grade);

}

/*The conditional according to the grade value*/

if (grade >= 90){

     printf("Your grade is A\n");

}

else if (grade >= 80 && grade < 90){

     printf("Your grade is B\n");

}

else if (grade >= 70 && grade < 80){

     printf("Your grade is C\n");

}

else if (grade >= 60 && grade < 70){

     printf("Your grade is D\n");

}

else{

    printf("You got a failling grade\n");

}

return 0;

}

8 0
4 years ago
List any four e-commerce website​
Ipatiy [6.2K]

Answer:

Amazon. Founded in the US in 1994, Amazon started as an online bookstore that later diversified to products including media, electronics, apparel, furniture, food, toys, and jewelry.

eBay. ...

Walmart. ...

Etsy. ...

Home Depot. ...

Target. ...

Best Buy. ...

Wayfair.

5 0
3 years ago
Read 2 more answers
Your company has decided to hire a full-time video editor. You have been asked to find a system with the level of display qualit
mote1985 [20]

Answer:

"Resolution" and "Refresh rate" is the correct answer.

Explanation:

Resolution:

  • The resolution would be a step for describing the spatial brightness as well as cleanliness of something like a photograph but rather an image. It's always commonly being utilized for the performance evaluation of monitoring devices, digital photographs as well as numerous additional technology components.

Refresh rate:

  • A computer display as well as visualization technology feature that determines the equipment frequency as well as capacity for repainting or re-drawing that this whole presentation upon on-screen for every instant.
4 0
3 years ago
Probablilty can use to determine the likehood of specific_________​
maria [59]

the answer is occurrences

6 0
3 years ago
Read 2 more answers
Given the following function definition, what modifications need to be made to the search function so that it finds all occurren
Naddika [18.5K]

Answer:

The answer is "Option b".

Explanation:

In the given question, a function "search" is defined. That searches element that is passed in the function by parameter. To search more quickly we must add another parameter in the function. and other options are not correct that can be described as:

  • In option a, We add another element in parameter to start searching not to stop.
  • In option c, The function can not find an element that occurs in the array target.
  • In option d, Function will not return array it will return only index value.

7 0
3 years ago
Other questions:
  • Select the correct answer.
    7·1 answer
  • When the speaker compares dream memories to fall leaves that are hard to catch,what feeling does the simile suggest?
    14·2 answers
  • Write a MIPS program to generate the following series of integers: 1, 2, 3. 6, 9, 18. 27, 54. 81. If you are curious where this
    13·1 answer
  • What is important for an internet user to know about https:// ?
    9·1 answer
  • To retrieve an outlook express e-mail header right-click the message, and then click ____ to open a dialog box showing general i
    7·1 answer
  • Assume that someone dictates you a sequence of numbers and you need to write it down. For brevity, he dictates it as follows: fi
    14·1 answer
  • Explain by details operator overloading in C++ with example
    6·1 answer
  • Careers in information technology deal with
    12·2 answers
  • Briefly tell me what a PUT request does
    11·1 answer
  • Write a function named partfthat takes inas parameterstwo parallel lists: a list of times (in increasing order), and a list of d
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!