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]
3 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]3 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
AirPods se están despintando al ponerlos en quitaesmalte ayudaaaa?
slega [8]

Answer:

In reality, a diluted type of acetone that dissolves plastics and coating is Nail polish removers.

Explanation:

The chemical composition of the material has permanently changed, nothing else than if you had shot it. No repair but replacement is available.

Acetone does not get along with plastics.

This classic timelapse video shows just how cheap plastic acetone is.

When it's out, I have my new AirPods Pro. I got a odd smell when I opened the box when I received it. The little one is solid and chemical. It's new, I guess, and after days it will be gone.

But after ten days of use it doesn't. And the smell remains strong. It won't go quickly, I believe.

Instead I noticed that the smell is often shaping the silicone tips.

About 8 hours a day I use this AirPods Pro. Is it possible for a long time to use this smelling tip?

Actually, I must say they are soft and work well for noise cancelation, I love this silicone tip. If the strange smell doesn't hurt. To me, that's good.

6 0
3 years ago
In which order does the processor search computer memory when it requires instruction or data?
skelet666 [1.2K]

Answer:

I think the answer is

Ram- Cache Memory-Hard disk

Explanation:

I hope this helps you

4 0
3 years ago
A(n) _____ is used to create a new file or to overwrite an existing file by attaching it to a command that produces output.
Alex787 [66]

Answer: Redirection symbol

Explanation: Redirection symbol/operator is the special operator that is used in programs along with commands. The operators that are generally used are ">",">>","I" and "<". These commands are given in the section of the DOS commands and other command prompt sections. This is the process where the changes in input feed and output is  analyzed and read through these commands.

3 0
3 years ago
What is a saved link to a particular web page?​
il63 [147K]

Answer:

In a website, a hyperlink (or link) is an item like a word or button that points to another location. When you click on a link, the link will take you to the target of the link, which may be a webpage, document or other online content. Websites use hyperlinks as a way to navigate online content.

4 0
2 years ago
Osha requires employers pay for most required personal protective equipment including
zzz [600]
*Metatarsal foot protection
*Rubber boots with steel toes
*Non-prescription eye protection
*Prescription eyewear inserts/lenses for
full face respirators
*Goggles and face shields
*Fire fighting PPE (helmet, gloves, boots,
proximity suits, full gear)
*Hard hats
*Hearing protection
*Welding PPE
7 0
3 years ago
Other questions:
  • You are training to complete in a local 5K run. You record your time scores in minutes after completing seven practice runs. Wri
    5·1 answer
  • What shows on the web, what is behind the web (source code) and what is placed on the server (database) , is known as web source
    13·1 answer
  • Which of the Arts, A/V Technology, and Communication career cluster pathways are involved with producing a product for an audien
    8·2 answers
  • On hearing my name, you may think that I am iterative, but I play a vital role in networking by boosting the signal strength to
    13·1 answer
  • You are reviewing the style sheet code written by a colleague and notice several rules that are enclosed between the /* and */ c
    12·1 answer
  • Write a definition of the function printDottedLine, which has no parameters and doesn't return anything. The function prints to
    14·1 answer
  • Which software application offers a variety of templates for creating reports, flyers, and newsletters that you can access withi
    7·1 answer
  • Differentiate between the broadcasting and telecommunication
    5·1 answer
  • Charlie wants you to include the following topics in your presntation: an overview of project management and its hrity,a descrip
    15·1 answer
  • Steps to copy and paste text/information from website to Ms-word using keyboard​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!