Question: PROGRAM DESCRIPTION: The purpose of this programming project is to write a C++ program to simulate a disease outbreak within a region and determine how
PROGRAM DESCRIPTION: The purpose of this programming project is to write a C++ program to simulate a disease outbreak within a region and determine how many days the outbreak lasted. You will be using an SIR model to model the disease progression in a person, and a cellular automata to represent the population in the geographic region. Your program will simulate the disease outbreak one day at a time, until no infectious people are left.
BACKGROUND: In disease modelling, one of the basic models is called the SIR model. SIR stands for Susceptible, Infectious, and Recovered, which represent the different health states a person can be in with regard to an illness. A susceptible person is someone who is not sick, but can become sick. An infectious person is someone who is sick and can infect others with the disease. A recovered person is someone who is no longer sick and has developed an immunity to the disease. For this model, we will be assuming that the immunity is permanent. To simulate the disease progression across the geographic region, we will be using a cellular automata. Each cell represents one persons health state.
. REQUIREMENTS: You will need to declare a global integer constant called SIZE and initialize it to 7.
You will need to declare and define a function to initialize the value of all slots in an array to s o It should have a two-dimensional char array and an integer as its parameters. o It should not return a value.
You will need to declare and define a function to output the char value of every slot in an array in a grid format o It should have a two-dimensional char array and an integer as its parameters. o It should not return a value.
You will need to declare and define a function to count the total number of i in an array. It should then return that count. o It should have a two-dimensional char array and an integer as its parameters. o It should not return a value.
You will need to declare and define a function to allow for infectious people (i) to become recovered (r). For each i in the current day, the function should update the corresponding slot in a next days array to r. Once all of the appropriate slots in the next days array have been set to r, you should update all of the values in the current days array with all of the values in the nexts day array. By using two arrays, this avoid any problems that may be incurred by updating values in place, such accidentally infecting people who should not be infected, or not infecting people who should be infected. o It should have a two-dimensional char array and an integer as its parameters. o It should not return a value.
You will need to declare and define a function spread the disease across the region. For each s in the current day the function should examine the surrounding 8, 5, or 3 slots (depending on if the s is in the middle of the array, on a border, or in a corner respectively) and if any of the surrounding slots contain an i, the position of the examined s should be set to i in next days array. By updating using two arrays this prevent accidental infecting of people who are not near any infectious people (i) today, but will be tomorrow. o It should have a two-dimensional char array and an integer as its parameters. o It should not return a value.
Inside your main function you will need to: o Create two SIZExSIZE two-dimensional char arrays, one to represent the current days region, and one to represent the next days region. o Create two integers to store user defined coordinates of which slot they would like to infect. o Create one integer to store the day number, and it should be initialized to 0. o You will need to initialize both char arrays to all s using the appropriate function. Be sure to use SIZE when passing in the size of the arrays. o You will then need to prompt for and read in two integers representing the x and y coordinates of where the infected person will be, and store them in the appropriate variables. Be sure to check if the input values are within the bounds of the region, and if they are not, politely, repeatedly prompt the user for correct coordinates. o Using the users coordinates, you should set those positions in the current days array to i. o Then, you should print out the current day value with an appropriate label, and print out the state of current days region using the appropriate function. o Next, you should simulate the spread of the disease. This should be done by first using your function to examine the current days array and setting the appropriate slots in the next days array to i. Next, you need to use the appropriate function to set all of the current days i to r in the next day array, and then overwrite the current days array with the next days array. Finally, you should print out the current day value and the current days region using the appropriate function. You should continue doing this until the current days region does not contain any i. o Finally, your program should print out the total number of days the outbreak lasted with an appropriate message.
you are not to use global variables (other than SIZE), or goto statements.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
