Question 1: Consider the world of Blade Runner, in which the population includes both humans and replicants.
In the version of this world, we will consider, each person (human or replicant) may be a harasser, who harasses members of the opposite group whenever they encounter them.
For this exercise, write a program that simulates encounters in this world, demonstrating the “Petrie Multiplier” effect that shows that members of smaller groups experience dramatically more cross-group harassment than members of larger groups.
Your program should take four parameters from the user: the population size (an int), the number of encounters to simulate (an int), the probability that a newly generated person will be a replicant (a double), and the probability that a newly generated person will be a harasser (a double). It should then create the population, simulate the encounters, and print, separately for humans and replicants, the minimum, maximum, and average number of times that they are harassed.
Include in your source code, in a comment, the results of running your program with 100 for the population size, 1000 for the number of encounters, 0.2 for the probability of being a replicant, and 0.2 for the probability of being a harasser.
Your program should create a Person class that is used to represent members of the population, with instance variables indicating whether or not the person is a replicant, whether or not the person is a harasser, and the number of times the person has been harassed. If the user provides invalid input, your program must handle the exception and ask the user for a new value.
Question 2: Submit a program that defines a new class and uses instances of the class for some purpose. This could be a new program, a revision of one of your previously submitted exercises, or a revision of one of the programs presented in class. The only requirement is that you define a new class, and that you use instances of the class for some purpose.
( Let me know if you want me to attach old codes from class for this question if you want)
Helpful instructions from teacher for question 1.
Add code to:
Make the class
Make an instance
Make two instances and make them encounter each other
Create a population
Simulate all of the encounters
Gather and print the needed statistics
Get parameters from user, handling exceptions
Run code and print stuff at every op