Question

In: Computer Science

This PYTHON3 program has 6 parts: Part1: Purpose: To practice processing a single line from a...

This PYTHON3 program has 6 parts:

Part1:
Purpose: To practice processing a single line from a read in tabular text file
Write a function named “fnSperateLine()" which takes an input parameter:
• A string of a raw line from a text file
with the return value of the function is:
• A list of strings containing each element from the input line by eliminating whitespaces (spaces or new line characters) and separators .
For example, if the value of the input parameter is “10\n", the return list should be [“10"]; if the value of the input parameter is “1, 2, 3\n", the return list should be [“1", “2", “3"].
Please note separators in this assignment are all commas.

Part 2 :
Purpose: To practice reading from a tabular file to a simple dictionary
Before starting this part, first, download the data file "parameters.txt". Make sure to put it in the same folder as your a6.py python code.
Write a function called fnReadInParameters() that takes as parameter(s):
• a string indicating the name of the parameter file
This function should return a dictionary that stores all of the parameter file data of the SIR model in a format that we will describe further below.

Input File Format:
The data file "parameters.txt", for this part is:

gamma, 14.0
beta_normal, 0.2
beta_intervention, 0.1
simulation_days, 540
N, 10000

Each line of the file contains a name-value pair of a parameter. The first item of a line is always the parameter’s name. It is clear that names of parameters are unique. The second item is always the value of the
parameter in the same line. All of the data items of each line are separated by commas. The function of “fnSperateLine()" created in part1 should be called to process lines of the read in file.

Dictionary Format:
Your function should open the file given as a parameter and read the data from it into a dictionary. The keys for this dictionary will be the parameter names, and the values of this dictionary will be the values of the corresponding parameters.
The data type of the keys in this dictionary is always strings. However, each entry’s data type of the value in the dictionary is different:
• The type of the value of parameter “gamma", is a float.
• The type of the value of parameter “beta_normal", is a float.
• The type of the value of parameter “beta_intervention", is a float.
• The type of the value of parameter “simulation_days", is an integer.
• The type of the value of parameter “N", is a float.
Once the dictionary is built, the function should return it.

Part 3:
Purpose: To practice read in a complex tabular file and create a list of dictionaries
Before starting this question, first, download the data file "state_input.txt".
Make sure to put it in the same folder as your a6.py python code.
Write a function called fnReadInInitialState() that takes as parameter(s):
• a string indicating the name of the state input file
This function should return a list of records (dictionaries) that stores state (values of S, I and R) of all days provided in the state_input.txt le in a format that we will describe further below.

Input File Format
The data file "state_input.txt", for this part is:
time(day),S,I,R
0,9999,1,0
1,9998.840016, 1.0885554285714287, 0.07142857142857142
2, 9998.66586733474, 1.1849501346490998, 0.1491825306122449
3, 9998.476300607286, 1.289877566769976, 0.23382182594432346
4, 9998.269951642773, 1.4040924193703885, 0.3259559378564646
5, 9998.045335722038, 1.528416024435801, 0.42624825352577805
6, 9997.800836958771, 1.663742214528266, 0.5354208266997639
7, 9997.534696745894, 1.8110436977974138, 0.6542595563089257
8, 9997.245001190597, 1.9713789889658695, 0.7836198204373124
9, 9996.92966745071, 2.1458999439259956, 0.924432605363446


This text file contains values of the count of persons in three compartments S, I and R (also known as state) at the beginning time points (“days" in this problem). Those values of state are manually calculated by the epidemiologists. It is notable that values of S, I and R are decimals (not integers) because those values are calculated by the epidemiologist from the SIR model. The goal of this whole assignment is reading those initial state in, and calculate the values of state forward for a given number of days. And in this part, your job includes reading the values of state in and storing them in a list of dictionaries. The first line is the names of elements from the second to the last line in this file. Formats of the data from the second to the last line are all the same. They are the values of the state (S, I and R) at each day (each time point). All of the data items of each line are separated by commas. And the function of “fnSperateLine()" created in part1 should be called to process lines of the read in file.

Data Stucture Format
Your function should open the file given as a parameter and read the data from it into a list of records (dictionaries). This list contains all the state of the SIR model with the order of time. For example, the first record in the list is the state at time 0, the second record in the list is the state at time 1, and go on.
Firstly, your function should create an empty list of the state. Then, for each line from the second to the last line in the input file, create one record (i.e. one dictionary) with the following fields ( the function of “fnSperateLine()" created in part1 should be called to process lines):
• The key of “S", and the value of this entry is the value of “S" at each time.
• The key of “I", and the value of this entry is the value of “I" at each time.
• The key of “R", and the value of this entry is the value of “R" at each time.
The data types of the keys in this record are all strings, and the data types of the values in this record are all floats. Those records should then be added to the list of state, with the order of time. Once all of the records have been added, the function should return the list of state, which is a list of
dictionaries

Part 4:
Purpose: To practice more operations in list, dictionaries, loops and branching
This model is a little more complicated, and requires a longer description.
In this part, you will write a function named simulation() that simulate the calculation of the SIR model by calculating the daily state (values of S, I and R) forward based on the list of state created in part3.
This function simulation() should take in three input parameters:
• A dictionary of the parameters created in part2;
• A list of records of the beginning days’ state created in part3;
• A boolean indicates whether a run of the simulation is performing intervention or not.
This function will not return values. However, this function will update the list of records and let this list contains the state of all the days that both read in from the state input file in part3 and calculated forwardly by this function.

The introduction of the SIR model
The main job of the SIR model is calculating the values of S, I and R forwardly day by day, based on the parameters and beginning state provided by input text files, and also by the mathematical equations of calculating the value of S, I and R of each day:
At each day, to update the values of S, I and R, we need to calculate two intermediate variables first:
• The number of new infected persons per day is dened as:
new_infected = β ∗ I_last_day ∗ S_last_day/N
where β indicates the number of susceptible persons can be infected by one infective per day. N is the total population of the town.
• The number of new recovered persons per day is defined as:
new_recovered = I_last_day/γ
where γ indicates the mean time that an infected person being recovered in days.
It is notable that the values of the parameters of γ and N are already provided by the parameters text file.
And these values have been already read in a dictionary of parameters in part2.
However, the value of parameter of β varies based on whether the current run of the function simulation() is with an intervention of decreasing contacts among population or not. Meanwhile, the third input parameter of the function simulation(), with a data type of boolean, controls which situation (intervention or not) the function simulates.
• if under the situation of an invention of decreasing contacts among population, the argument pass to this boolean parameter is "True". Then, the value of β will use the value of β_intervention in the parameter file;
• if under the normal situation, which means no interventions performed, the argument pass to this boolean parameter is "False". Then, the value of β will use the value of β_normal in the parameter file.
Then, the equations of calculating the current day’s (or a new day’s) state of S, I and R are as follows:

S_new_day = S_last_day − new_infected
I_new_day = I_last_day + new_infected − new_recovered
R_new_day = R_last_day + new_recovered

The total number of days this function will calculate forward is defined by the integer parameter in the parameter file named “simulation_days". It means the function of simulation() should repeatedly calculate the values of S, I and R for “simulation_days" days, starting from the last day in the state input text file. For example, if the last day in the state input file is the 10th day with the time index (day) is 9, and the value of the parameter of “simulation_days" is 20. Then, the function of simulation() should calculate the values of S, I and R 20 times day by day by loops, starting from the last day (day 10) in the state input file (or in the list of state). Each new calculated state (values of S, I and R ) – stored as a record – should also be added to the list of state at the end of each loop. Finally, there will be 30 records in the list of state, where the first 10 records are read in from the state input file, and the last 20 records are calculated by the SIR model (by the function simulation()).

How to complete this part
First, your program should calculate the parameter value of “β" based on the value of the input boolean parameter which indicates whether this run of the simulation is under intervention strategy or not.
Second, your program should get the value of “simulation_days" from the parameter dictionary.
Third, your program should have a loop iterating “simulation_days" times.
Fourth, inside the loop, your program should get the values of S, I and R of the latest day in the list of state. They should be located in the last record of the list of state.
Fifth, also inside the loop, your program should calculate the values of new_infected and new_recovered
based on the latest state (S, I and R) generated in the fourth step.
Sixth, also inside the loop, your program should calculate a new day’s state of S, I and R based on the values of S, I and R of the latest day got from the list of state in the fourth step, and the new calculated variables of new_infected and new_recovered.
Seventh, also inside the loop, your program should create a record of the new day’s state of S, I and R.
Finally, also inside the loop, your program should add each new day’s state (the record created in the seventh step) to the end of the list of state.

Part 5 :
Purpose: To practice write a list of records to a tabular text file

In this question, your program will define a function named fnWriteState(), with two input parameters:
• A list of records (the list of state of all days)
• A string of a path name of the output file
And there is no return values of this function.
In this function, your program will write the list of state to a tabular file. It is notable that the output file should locate in the same folder of the a6.py file. In the state output file, the first line is names of the time,
S, I and R. And lines from the second to the last line of the output file contain every day’s state of S, I and R in the list of state, and also with the item of time (indicates the index of the day). Each record in the list of state will be written in one line. And the items of each line will be separated by commas. Basically, the format of the state output fi le is the same as the state input file. But in the state output file, both the state of being read in from the state input file, and calculated by the simulation function in Q4 are all included.
The state output file is :

same file as part 3

Part 6:

Purpose: To practice solving a problem by calling multiple functions
Now it’s time to put all your functions together to simulate the SIR model, and output the whole state to a tabular file.
In the main part of your program, write code calling functions defined in part1-part5 properly to complete a whole simulation process of the SIR model, to simulate the spreading of the virus in “simulation_days" days:
First, call the function of fnReadInParameters() to read in parameters from the parameter file to a dictionary.
Second, call the function of fnReadInInitialState() to read in beginning state from the state input file to a list of records.
Third, defines the variable of the boolean input parameter of function of simulation() to indicate whether the run is intervention or not. Any value of this boolean parameter dened in your code submitted is ok.
But you need to test your program by running at least twice and defining this boolean parameter as “True" and “False" respectively. Please note that you will loose marks if the results in any case are not correct.
Fourth, call the function of simulation() to complete the simulation of calculating “simulation_days" days and add all the new calculated state values of S, I and R to the list of records.
Finally, call the function of fnWriteState() to write the whole list of state to a tabular text file named
“state_output.txt" and located in the same folder of the a6.py file.
Note: Normally in modelling and simulation or other scientic researches, visualization is a useful tool to
efectively show and analyze the results. We have provided you the plots of the list of state ( S, I and R with time) in the section of “Appendix of Visualization". You may read this appendix if you are interested in the plot of the results (maybe the plots can also help you to double check your results of the simulation). But the appendix will not contribute any marks to this assignment. It simply aims to extend your knowledge of the infectious diseases modelling and is for fun!

Finally, do not forget to call the method of close() to close a file object.

Solutions

Expert Solution

Code In Python:

from collections import defaultdict

class Make_File:
  
def fnSperateLine(self,str_):
  
str_ = str_.strip(" \n\t")
  
list_ = str_.split(",")
  
return list_
  
def fnReadInParameters(self,file_name):
  
dictionary = {}
  
  
fopen = open(file_name,"r")
  
line = self.fnSperateLine(fopen.readline())
dictionary.update({line[0]:float(line[1])})
line = self.fnSperateLine(fopen.readline())
dictionary.update({line[0]:float(line[1])})
line = self.fnSperateLine(fopen.readline())
dictionary.update({line[0]:float(line[1])})
line = self.fnSperateLine(fopen.readline())
dictionary.update({line[0]:int(line[1])})
line = self.fnSperateLine(fopen.readline())
dictionary.update({line[0]:float(line[1])})
  
return dictionary
  
def fnReadInInitialState(self,file_name):
  
f_open = open(file_name,"r")
  
f_open.readline()
  
  
list_ = []
  
for x in f_open:
  
x = self.fnSperateLine(x)
  
dictionary = defaultdict()
dictionary.update({"S":float(x[1])})
dictionary.update({"I":float(x[2])})
dictionary.update({"R":float(x[3])})
  
list_.append(dictionary)
  
  
return list_
  
def simulation(self,dictionary,list_,bool_):
  
beta = 0
  
if bool_ == True:
beta = dictionary["beta_intervention"]
else :
beta = dictionary["beta_normal"]
  
  
simulation_days = dictionary["simulation_days"]
  
N = dictionary["N"]
  
  
for i in range(0,simulation_days):
  
S_latest_day = list_[len(list_)-1]["S"]
I_latest_day = list_[len(list_)-1]["I"]
R_latest_day = list_[len(list_)-1]["R"]
  
new_infected = beta * I_latest_day * S_latest_day/N
new_recovered = I_latest_day/dictionary["gamma"]
  
S_new_day = S_latest_day - new_infected
I_new_day = I_latest_day + new_infected - new_recovered
R_new_day = R_latest_day + new_recovered
  
dictionary1 = defaultdict()
dictionary1.update({"S":S_new_day})
dictionary1.update({"I":I_new_day})
dictionary1.update({"R":R_new_day})
list_.append(dictionary1)
  
return
  
  
  
def fnWriteState(self,list_,file_name):
  
str_ = "time(day),S,I,R\n"
  
fopen = open(file_name,"w")
  
fopen.write(str_)
  
count = 0
  
for x in list_:
  
str_ = ""+str(count)+","+str(x["S"])+","+str(x["I"])+","+str(x["R"])+'\n'
count = count + 1
fopen.write(str_)
  
return
  
  
def main():
  
  
cls = Make_File()
  
file_name1 = "C:\\Users\\DELL\\Desktop\\parameters.txt"
file_name2 = "C:\\Users\DELL\\Desktop\\sample.txt"
file_name3 = "C:\\Users\\DELL\\Desktop\\output2.txt"
  
  
dictionary = cls.fnReadInParameters(file_name1)
  
list_ = cls.fnReadInInitialState(file_name2)
  
bool_ = False
  
cls.simulation(dictionary,list_,bool_)
  
cls.fnWriteState(list_,file_name3)
  

if __name__ == "__main__":
main()

Input :

parameters file

sample.txt file

Output:

output.txt file

Explaination:

Make_File contains function:

  • fnSperateLine
  • fnReadInParameters
  • fnReadInInitialState
  • fnReadInInitialState
  • fnReadInInitialState

All the functions are developed same as metion in problem statement and also the input are taken same as mention in problem stament

Function are developed step by step as mention in problem statement

I have generated two output.txt file for bool_ = True and i have pasted top 100 lines

time(day),S,I,R
0,9999.0,1.0,0.0
1,9998.840016,1.0885554285714287,0.07142857142857142
2,9998.66586733474,1.1849501346490998,0.1491825306122449
3,9998.476300607286,1.289877566769976,0.23382182594432346
4,9998.269951642773,1.4040924193703885,0.3259559378564646
5,9998.045335722038,1.528416024435801,0.42624825352577805
6,9997.800836958771,1.663742214528266,0.5354208266997639
7,9997.534696745894,1.8110436977974138,0.6542595563089257
8,9997.245001190597,1.9713789889658695,0.7836198204373124
9,9996.92966745071,2.1458999439259956,0.924432605363446
10,9996.71514334258,2.207145484630856,1.0777111727867315
11,9996.494501295683,2.270134282626347,1.2353644216889355
12,9996.267567446948,2.334915682602093,1.3975168704479601
13,9996.034163027842,2.4015404100948436,1.5642965620623954
14,9995.794104228009,2.470060609205783,1.7358351627834556
15,9995.547202055262,2.540529881294077,1.9122680634410116
16,9995.293262191795,2.613003324668711,2.0937344835334457
17,9995.032084846544,2.687537575300977,2.280377578152639
18,9994.7634646036,2.764190848580261,2.4723445478169945
19,9994.487190266575,2.843022982136058,2.6697867512870133
20,9994.203044698808,2.924095479749406,2.872859821439589
21,9993.910804659341,3.007471556377178,3.0817237842788323
22,9993.610240634522,3.093216184312929,3.2965431811629164
23,9993.301116665161,3.181396140508181,3.5174871943281256
24,9992.983190169127,3.2720800550782574,3.7447297757929956
25,9992.656211759255,3.3653384610169432,3.978449779727157
26,9992.319925056483,3.4612438451444087,4.218831098371225
27,9991.974066498089,3.559870700312964,4.466062801595825
28,9991.618365140914,3.661295578895316,4.7203392801896085
29,9991.252542459451,3.765597147580076,4.981860392967845
30,9990.876312138706,3.8728562434993026,5.250831617794994
31,9990.48937986167,3.983155931712881,5.527464206616372
32,9990.091443091329,4.096581564074495,5.811975344595863
33,9989.682190847037,4.213220839503894,6.104588313458327
34,9989.261303475172,4.333163865690021,6.405532659137177
35,9988.82845241392,4.4565032222494185,6.715044363829321
36,9988.383299952073,4.583334025364111,7.033366022561422
37,9987.925498981702,4.713753993922878,7.360747024373144
38,9987.454692744583,4.847863517189536,7.697443738224779
39,9986.970514572236,4.985765724021397,8.043719703738317
40,9986.472587619453,5.127566553660678,8.399845826882702
41,9985.96052459116,5.273374828121039,8.766100580715607
42,9985.43392746251,5.423302326190859,9.142770211295682
43,9984.892387192043,5.577463859074123,9.530148948880743
44,9984.33548342778,5.735977347689051,9.928539224528896
45,9983.762784206134,5.898963901643674,10.33825189222097
46,9983.173845643467,6.066547899906609,10.75960645662409
47,9982.56821162019,6.238857073190189,11.19293130661742
48,9981.945413457233,6.416022588061877,11.638563954702432
49,9981.304969584779,6.598179132798594,12.096851282421138
50,9980.646385203094,6.785465004997112,12.568149791906752
51,9979.969151935353,6.97802220095207,13.05282586369226
52,9979.272747472283,7.175996506811425,13.551256020903121
53,9978.556635208519,7.379537591517262,14.06382719996108
54,9977.820263870533,7.588799101537796,14.5909370279266
55,9977.063067135996,7.803938757394189,15.132994106607871
56,9976.28446324445,8.02511845198335,15.690418303564599
57,9975.483854599168,8.252504350695288,16.263641050134837
58,9974.660627360065,8.486266993320756,16.85310564661307
59,9973.814151027549,8.726581397741835,17.45926757470741
60,9972.9437780172,8.973627165394904,18.082594817403255
61,9972.048843225146,9.227588588491837,18.723568186360033
62,9971.12866358405,9.488654758981554,19.382681656966593
63,9970.182537609588,9.757019679229927,20.06044271117956
64,9969.209744937338,10.03288237439179,20.757372688267413
65,9968.209545849972,10.316447006444058,21.47400714358111
66,9967.181180794683,10.607922989844107,22.210896215469973
67,9966.123869890765,10.907525108772179,22.968605000458837
68,9965.036812427286,11.21547363591098,23.747713936799705
69,9963.91918635078,11.53199445270966,24.548819196507633
70,9962.770147742938,11.857319171072843,25.372533085986895
71,9961.58883028824,12.191685256408743,26.219484455349242
72,9960.374344731514,12.535336151963001,27.090319116521297
73,9959.125778325408,12.888521404357336,27.98570027023294
74,9957.842194267781,13.251496790243865,28.90630894197275
75,9956.52263112903,13.62452444397739,29.852844426990167
76,9955.16610226938,14.007872986198748,30.826024744417122
77,9953.77159524621,14.401817653212703,31.826587100574177
78,9952.338071211445,14.80664042703358,32.85528836151794
79,9950.864464299158,15.222630165961085,33.91290553487748
80,9949.349681003443,15.650082735537314,35.00023626101756
81,9947.792599546718,16.08930113972389,36.118099313555945
82,9946.192069238621,16.540595652125567,37.26733510925051
83,9944.546909825665,17.00428394707314,38.44880622725948
84,9942.85591083187,17.48069123036456,39.66339793776471
85,9941.117830890616,17.970150369448234,40.9120187399336
86,9939.331397068001,18.473002022817006,42.1956009091799
87,9937.495304177966,18.989594768364935,43.51510105366683
88,9935.608214089578,19.520285230441843,44.87150067997862
89,9933.668755026809,20.065438205322632,46.26580676786732
90,9931.675520861247,20.625426784789504,47.69905235396179
91,9929.627070398188,21.200632477505497,49.172297124303896
92,9927.521926656606,21.79144532783712,50.68662801555429
93,9925.35857614355,22.398264031762317,52.24315982468551
94,9923.135468123566,23.021496049477378,53.84303582695425
95,9920.851013883788,23.661557714293064,55.48742840191692
96,9918.50358599539,24.31887433738556,57.17753966722357
97,9916.091517572162,24.99388030794246,58.91460211989397
98,9913.613101527035,25.68701918821745,60.699879284747006
99,9911.0665898274,26.398743802979663,62.53466636961968
100,9908.45019275021,27.12951632281522,64.42029092697537

I have generated two output.txt file for bool_ = False and i have pasted top 100 lines
  

time(day),S,I,R
0,9999.0,1.0,0.0
1,9998.840016,1.0885554285714287,0.07142857142857142
2,9998.66586733474,1.1849501346490998,0.1491825306122449
3,9998.476300607286,1.289877566769976,0.23382182594432346
4,9998.269951642773,1.4040924193703885,0.3259559378564646
5,9998.045335722038,1.528416024435801,0.42624825352577805
6,9997.800836958771,1.663742214528266,0.5354208266997639
7,9997.534696745894,1.8110436977974138,0.6542595563089257
8,9997.245001190597,1.9713789889658695,0.7836198204373124
9,9996.92966745071,2.1458999439259956,0.924432605363446
10,9996.500619234454,2.421669592759002,1.0777111727867315
11,9996.016454802782,2.7328576249481484,1.2506875722695172
12,9995.47010100703,3.0840073046327223,1.4458916883372421
13,9994.853578950935,3.480243124682401,1.6661779243824366
14,9994.157888541928,3.927344739069255,1.914766719002608
15,9993.372878473827,4.431830182949875,2.1952913432218404
16,9992.487099842781,5.001049515213601,2.5118506420039743
17,9991.487641387452,5.6432901480272815,2.8690684645192315
18,9990.359944112037,6.367895270012324,3.2721606179497518
19,9989.08759279536,7.18539692454522,3.7270102800934892
20,9987.652081609995,8.107665472443397,4.240252917561005
21,9986.032550771337,9.148077348782946,4.81937187987839
22,9984.205490807699,10.321703216079717,5.472805976220029
23,9982.144410689209,11.645518819134864,6.210070491654295
24,9979.819465677409,13.138641058139578,7.041893264449643
25,9977.197040361718,14.82259201253529,7.980367625745327
26,9974.239281938559,16.721593863370465,9.039124198069276
27,9970.903578371186,18.862897869074196,10.233523759738596
28,9967.141975653962,21.277150738507224,11.58087360752961
29,9962.900528009,23.99880190214712,13.100670088851555
30,9958.11857448615,27.06655528912917,14.814870224719206
31,9952.72793514671,30.523869250774897,16.748195602514148
32,9946.65201982309,34.41950819933861,18.928471977569497
33,9939.804842408044,38.808149314431226,21.387008277522256
34,9932.089933798436,43.75104725872427,24.15901894283877
35,9923.399147077005,49.31675917595998,27.28409374703336
36,9913.611349358138,55.58193123940073,30.806719402459073
37,9902.590996071054,62.63214658081259,34.776857348130555
38,9890.18658545514,70.5628324409554,39.250582103902886
39,9876.228993878354,79.48022170052943,44.29078442111398
40,9860.529696478381,89.50236040760743,49.96794311400894
41,9842.878882824298,100.76014831828937,56.36096885740947
42,9823.04348410205,113.39839358922968,63.55812230871585
43,9800.765137076964,127.57685535794259,71.6580075650894
44,9775.758121151162,143.47123875817593,80.77064009065674
45,9747.707318602324,161.27409568142906,91.01858571624074
46,9716.266264946828,181.1955710739666,102.53816397919995
47,9681.055376655153,203.4639185746441,115.48070477019756
48,9641.660467397705,228.3256907910458,130.01384181124357
49,9597.63169166588,256.04548860922563,146.32281972488968
50,9548.4830857462,286.9051310568177,164.61178319697723
51,9493.692909924004,321.2020832320986,185.10500684389277
52,9432.705031119336,359.2469560916166,208.04801278904267
53,9364.931619716543,401.3598706307237,233.70850965272956
54,9289.757464849443,447.865463309915,262.3770718406384
55,9206.546234228812,499.0863036941232,294.3674620770609
56,9114.649011632206,555.334504598292,330.0164837694983
57,9013.415429762965,616.9013361390843,369.6832340979477
58,8902.207669327017,684.0447154222408,413.74761525073944
59,8780.417507091128,756.9745408422561,462.6079520666138
60,8647.486456874456,835.8359809987672,516.677562126775
61,8502.928850357352,920.6910174445311,576.3801321981155
62,8346.357446067472,1011.4987776312297,642.1437763012963
63,8177.510838980061,1108.0954720306959,714.3936889892412
64,7996.281584316946,1210.1750501201898,793.5433655628624
65,7802.743574975428,1317.271984453123,879.9844405714474
66,7597.176864711693,1428.7478386844916,974.0752966038133
67,7380.08786420048,1543.7834221468124,1076.1287136527055
68,7152.222718225688,1661.3783236825461,1186.3989580917635
69,6914.571762421488,1780.3593992237074,1305.0688383548024
70,6668.363305844809,1899.399327284407,1432.2373668707814
71,6415.045610300615,2017.045642308285,1567.9087473910963
72,6156.256814431301,2131.759749441294,1711.9834361274025
73,5893.783604746734,2241.9644055943395,1864.2519896589235
74,5629.510543624381,2346.0971520313833,2024.3923043442335
75,5365.362970549825,2442.6663571036975,2191.970672346475
76,5103.247138113585,2530.306021175388,2366.446840711025
77,4844.991598891287,2607.8254160280153,2547.1829850806953
78,4592.293754250669,2674.2500166666323,2733.456229082696
79,4346.6749212738105,2728.8509913101598,2924.474087416027
80,4109.44635791739,2771.161626715855,3119.3920153667527
81,3881.687556835232,2800.9803116040234,3317.3321315607423
82,3664.236948385356,2818.3608977964695,3517.4021538181723
83,3457.694105673549,2823.5922478085286,3718.71364651792
84,3262.4317402320876,2817.169452692238,3920.3988070756723
85,3078.6152794305794,2799.759524015729,4121.625196553689
86,2906.227630443257,2772.1643498590706,4321.60801969767
87,2745.096817849453,2735.2834231772267,4519.619758973318
88,2594.92446143185,2690.078392225028,4714.99714634312
89,2455.3134569687704,2637.5409401006054,4907.145602930622
90,2325.7936616980687,2578.6649539355494,5095.541384366379
91,2205.844809587944,2514.423452193135,5279.7317382189185
92,2094.9162511654154,2445.750335459011,5459.333413375571
93,1992.4434086844883,2373.526725407151,5634.029865908357
94,1897.8610550970093,2298.5714557512624,5803.567489151726
95,1810.6136701324501,2221.6351653050174,5967.75116456253
96,1730.1632101254854,2143.397399218766,6126.439390655745
97,1655.9946636293462,2064.4661314849936,6279.539204885657
98,1587.6197656896927,1985.3791628900044,6427.0010714203
99,1524.5792216618402,1906.6069095685712,6568.813868769586
100,1466.4437560977374,1828.5561673063473,6705.000076595913



Related Solutions

Part1 Margen is single and has taxable income before the QBI deduction of $173,300. Margen owns...
Part1 Margen is single and has taxable income before the QBI deduction of $173,300. Margen owns a sole proprietorship (not a professional service) that produced net ordinary income of $180,000 and subject to self-employment tax of $21,300. The business paid total W-2 wages of $74,000 and the total unadjusted basis of prop­erty held by the business is $120,000. How much is Margen’s QBI deduction? Part2 a. Mourezky gave some long-term real estate to a church. The property was worth $33,000...
Program in Java using Inheritence The purpose of this assignment is to practice OOP programming covering...
Program in Java using Inheritence The purpose of this assignment is to practice OOP programming covering Inheritance. Core Level Requirements (up to 6 marks) The scenario for this assignment is to design an online shopping system for a local supermarket (e.g., Europa Foods Supermarket or Wang Long Oriental Supermarket). The assignment is mostly concentrated on the product registration system. Design and draw a UML diagram, and write the code for the following classes: The first product category is a fresh...
please using Repl.it basic C-programing part1 Write a program that requests 5 integers from the user...
please using Repl.it basic C-programing part1 Write a program that requests 5 integers from the user and stores them in an array. You may do this with either a for loop OR by getting a string from stdin and using sscanf to store formatted input in each spot in the array. part2 Add a function to the program, called get_mean that determines the mean, which is the average of the values. The function should be passed the array and the...
A C program that accepts a single command line argument and converts it in to binary...
A C program that accepts a single command line argument and converts it in to binary with array length of 16 bits. The array should contain the binary of the int argument. the program should also convert negative numbers. Side note the command line arg is a valid signed int.
Suppose a workstation receives parts automatically from a conveyor. An accumulation line has been provided at...
Suppose a workstation receives parts automatically from a conveyor. An accumulation line has been provided at the workstation and has a storage capacity for 5 parts (N=6). Parts arrive randomly at the switching junction for the workstation; if the accumulation line is full, parts are diverted to another workstation. Parts arrive at a Poisson rate of 1 per minute; service time at the workstation is exponentially distributed with a mean of 45 seconds. a. What is the rate at which...
Changes from the basic are highlighted yellowWrite a payroll processing program. Input will be from...
Changes from the basic are highlighted yellowWrite a payroll processing program. Input will be from a file called “weeklyData.txt”. You may create this file on your own for testing purposes, but I have provided a file with 75 employees that I will use to test your code. (I know what it should produce).Each line in the file contains information about one employee. Each item is separated by a space. The items are, in order:First Name Last Name Hourly wage rate...
C++ program to read line comments. This assignment will give you a little bit of practice...
C++ program to read line comments. This assignment will give you a little bit of practice with string parsing. Your task is to write a program that reads in a .cpp file line-by-line, and prints out only the text that's after the // characters that indicate a single-line comment. You do not have to worry about /* multiline comments */ though there will be a small amount of extra credit for programs that correctly extract these comments as well.
1 Purpose This is another program for reading from files. In this program we will read...
1 Purpose This is another program for reading from files. In this program we will read blocks of data from a (well-formatted) file that you will be given and make some computations on that data. The input file will be formatted as described later in this document. It will be similar the “block” data from Lecture 10. 2 Procedure You will create one source code program, Prog07.cpp. This program will 1. Prompt the user for an input filename. Store the...
Take all the methods from this program and put it into single program and compile, and...
Take all the methods from this program and put it into single program and compile, and then test the program with some expressions. Should have two files: Lex.java and a output.txt file package lexicalanalyser; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.logging.Level; import java.util.logging.Logger; enum CharacterClass{ LETTER(0), DIGIT(1), UNKNOWN(99), EOF(-1); private int value; private CharacterClass(int value){ this.value = value; } public int getValue(){ return value; } } enum TokenCodes{ INT_LIT(10), IDENT(11), ASSIGN_OP(20), ADD_OP(21), SUB_OP(22),...
Which of the following is an appraisal cost? a.Training program for production line workers b.Inspecting parts...
Which of the following is an appraisal cost? a.Training program for production line workers b.Inspecting parts as they come off the assembly line c.Reworking a product that failed inspection
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT