Question: Suppose that you wish to write a MATLAB script that simulates the dates of birth (day and month only) for n people and determines if
Suppose that you wish to write a MATLAB script that simulates the dates of birth (day and month only) for n people and determines if at least two of the n people have the same birth date. Each person has a 1 in 365 chance of having a birthday on a specific day and month (excluding leap years). For the birth dates, for example, January 1 is represented as birth date 1, and September 17 is represented as birth date 260. Write a MATLAB program that prompts the user for the number of people n to compare and randomly generates the birth dates for the n people. It should determine if at least two people of the n people have the same birthday. If the program determines that two people are found to have the same birthday during the analysis of all of the birthdays, no additional comparisons are required, and the program should output to the command window that two people share the same birthday. If none of the n people are found to have the same birthday, the program should output to the command window that no one was found to have the same birthday. Turn in a hardcopy of your code as well as results for n = 2, n = 30, n = 75, n = 100, and n = 250.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
