Write a program to read the parts.txt file and display the cost of inventory for each of the part classes. The file contains parts of class A, B, C and D. A typical line in the file would be:
P-11191 A 10 34.29
This is part number P-11191, a class A part, of which there are 10 in stock and each costs $34.29. Your program, therefore, would add 342.90 to class A inventory.
The parts file is on Canvas in this week’s module in .zip format. After downloading it, right click and choose Extract.
...................... INVENTORY REPORT
.....................
A parts Count: 85 Value of
inventory: 191180.07
B parts Count: 69 Value of
inventory: 74764.16
C parts Count: 77 Value of
inventory: 50322.30
D parts Count: 60 Value of
inventory: 22416.49
Unknown Count: 13 Value of
inventory: 4282.68
Press any key to continue . . .
parts.txt
P-39457 A 16 102.14
P-11702 B 21 24.74
P-11754 B 27 15.23
P-12009 D 3 12.80
P-12131 A 48 24.17
P-12385 B 41 27.33
P-12652 E 18 28.33
P-12677 D 15 26.59
P-12746 A 6 111.57
P-12746 C 25 14.83
P-12797 D 18 29.07
P-12856 A 33 120.96
P-13192 C 65 76.98
P-13289 C 45 36.61
P-13682 D 14 25.56
P-13713 A 10 35.12
P-14175 B 41 9.21
P-14226 D 14 28.95
P-14455 D 26 26.39
P-14493 A 29 22.09
P-14518 D 9 5.56
P-14613 A 49 74.66
P-14702 A 38 92.06
P-14748 C 24 24.80
P-38806 C 42 31.39
P-38870 A 29 127.19
P-38880 B 26 110.57
P-39014 A 30 111.33
P-39319 B 26 3.38
P-39499 B 32 37.50
P-39819 B 13 18.71
P-40002 B 9 86.81
P-40021 C 45 27.28
P-40100 B 9 40.04
P-40426 D 32 11.67
P-40784 B 4 106.76
P-41213 C 23 16.53
P-41254 D 5 11.13
P-41316 C 17 33.99
P-41359 A 44 132.94
P-43521 C 25 26.27
P-14976 C 45 22.16
P-15122 B 47 17.96
P-15825 E 27 25.76
P-15902 C 22 26.10
P-15944 D 33 15.94
P-16100 A 40 94.38
P-16283 A 44 108.99
P-16414 C 43 5.12
P-16420 D 12 25.72
P-16467 B 28 72.51
P-16803 D 44 13.61
P-17160 D 23 11.61
P-17243 A 7 69.19
P-17248 D 42 10.50
P-17295 C 2 9.26
P-17344 C 42 36.05
P-17345 B 3 33.14
P-17550 B 23 6.75
P-17644 B 24 2.62
P-17668 D 15 8.86
P-17788 F 34 9.84
P-17833 B 14 25.95
P-17871 C 4 11.70
P-18158 D 25 22.26
P-18553 A 39 5.31
P-18638 C 35 31.64
P-18827 A 26 99.28
P-19041 B 45 63.99
P-19152 A 28 133.91
P-19378 C 44 26.01
P-19505 B 7 54.98
P-19780 A 33 44.66
P-19798 D 17 22.09
P-19842 D 38 5.01
P-19943 D 30 17.46
P-19965 C 34 17.07
P-20097 A 2 26.46
P-20120 B 2 72.45
P-20126 D 6 7.17
P-20143 B 43 38.61
P-20206 B 17 39.00
P-20353 D 8 8.40
P-20486 A 20 186.81
P-20491 B 32 43.20
P-20864 C 27 33.88
P-20884 C 33 27.90
P-21071 A 28 146.96
P-21092 A 43 83.53
P-21282 C 37 10.50
P-21326 F 18 12.09
P-21499 D 30 20.19
P-21599 B 42 41.83
P-22018 B 47 46.58
P-22025 E 25 18.95
P-22083 A 45 3.64
P-22123 F 14 11.51
P-22204 A 46 100.85
P-22254 C 2 7.98
P-22391 B 47 6.69
P-22526 C 37 9.14
P-22547 C 15 32.88
P-22554 A 50 41.31
P-22604 A 10 125.74
P-22757 B 12 47.19
P-22844 D 10 0.50
P-23038 A 29 2.33
P-23102 A 11 56.07
P-23146 D 6 16.89
P-23379 D 43 19.29
P-23506 C 40 14.41
P-23975 D 5 6.84
P-24183 D 13 10.63
P-24253 A 40 120.22
P-24286 B 23 54.52
P-24383 C 44 9.01
P-24613 B 50 57.98
P-24675 E 21 14.22
P-24692 D 33 29.45
P-24724 B 45 6.45
P-24910 A 23 14.27
P-24991 D 34 28.48
P-35349 A 46 80.95
P-35432 A 36 69.73
P-35797 A 4 94.76
P-35809 B 30 30.69
P-35867 D 35 20.86
P-35936 B 22 31.21
P-35961 F 32 0.57
P-36143 D 29 9.53
P-36145 A 5 83.35
P-11196 B 39 59.04
P-11226 C 29 24.46
P-11245 D 45 0.93
P-11273 C 38 21.48
P-11281 B 40 66.47
P-11376 D 50 27.03
P-24992 C 123 45.00
P-13725 A 23 61.46
P-13726 B 12 51.08
P-13754 D 27 4.56
P-13947 C 34 27.71
P-13982 C 17 10.47
P-13987 D 17 27.24
P-13999 B 12 33.01
P-14036 A 41 67.24
P-14124 B 7 69.20
P-25157 A 32 84.01
P-25366 A 37 32.37
P-25405 D 2 8.61
P-25482 A 13 71.09
P-25513 B 15 76.05
P-25549 C 8 4.78
P-25564 D 24 13.30
P-25594 C 16 32.59
P-25602 B 39 15.05
P-25606 C 42 16.95
P-25648 C 3 25.89
P-25746 A 35 90.57
P-25895 D 39 26.89
P-25923 C 2 26.08
P-26188 C 48 32.37
P-26298 A 40 76.50
P-26377 C 21 21.78
P-26382 C 39 15.99
P-26408 F 9 0.37
P-26574 A 38 7.96
P-26576 C 13 23.59
P-26853 A 10 118.43
P-26868 A 2 125.05
P-27191 C 34 20.39
P-27225 C 34 14.28
P-27345 A 28 195.43
P-27417 C 42 1.61
P-27586 B 16 24.21
P-27648 D 10 1.39
P-27785 B 46 26.75
P-27812 C 5 18.37
P-27850 A 46 181.07
P-27873 B 13 102.37
P-27945 D 42 10.44
P-27969 C 2 12.52
P-28009 A 2 60.77
P-27987 C 49 5.37
P-28061 A 35 117.29
P-28309 B 28 34.06
P-28509 D 26 12.95
P-28510 D 13 16.13
P-28518 C 1 22.53
P-28690 A 45 19.34
P-28943 A 21 121.80
P-29044 D 14 6.17
P-29059 D 9 29.82
P-29096 A 49 106.39
P-11191 A 10 34.29
P-29182 A 11 26.83
P-29183 E 46 29.59
P-29185 A 28 73.08
P-29279 C 42 12.55
P-29518 A 17 147.52
P-29549 F 10 7.95
P-29637 B 18 87.18
P-29722 C 25 20.74
P-30037 C 37 22.19
P-30383 A 31 124.74
P-30538 B 1 2.86
P-30591 A 9 40.47
P-30643 A 7 81.94
P-10659 B 17 88.97
P-31007 A 3 11.77
P-31071 B 46 0.36
P-31136 A 29 89.83
P-31429 C 43 5.85
P-31497 A 38 28.12
P-31585 C 8 44.39
P-31701 B 35 51.74
P-31722 A 31 191.32
P-31739 B 24 71.54
P-31744 C 45 15.03
P-31763 A 13 130.56
P-31859 D 24 29.54
P-31969 C 20 17.44
P-32291 A 37 188.37
P-32382 C 44 29.54
P-32417 C 11 27.06
P-32467 C 15 2.73
P-32556 A 44 31.13
P-32599 B 43 66.23
P-32890 A 11 95.99
P-32901 D 32 4.44
P-33017 D 33 5.70
P-33066 C 25 30.27
P-33140 A 32 26.49
P-33143 B 45 44.69
P-33155 D 10 15.25
P-33195 C 11 24.63
P-33224 D 15 8.96
P-33382 C 46 3.44
P-33481 D 20 17.22
P-33491 C 32 24.65
P-33593 C 3 3.52
P-33597 A 2 28.85
P-33643 C 21 5.09
P-34050 B 16 18.99
P-34099 D 49 0.70
P-34106 A 24 63.59
P-34490 F 4 1.65
P-34503 C 7 8.64
P-34512 B 2 69.17
P-34554 A 33 11.27
P-34627 B 22 73.36
P-34670 B 39 112.66
P-34689 B 29 16.06
P-34711 C 1 23.09
P-34743 D 22 25.21
P-34826 B 16 111.01
P-34883 B 49 45.64
P-34991 B 10 41.79
P-34997 A 12 156.00
P-43582 B 3 13.18
P-41383 C 2 2.62
P-41644 D 43 3.40
P-41740 A 25 186.21
P-41754 D 4 20.07
P-41828 D 45 26.95
P-41936 A 11 59.17
P-42059 A 12 78.86
P-42117 C 19 3.07
P-42217 D 45 16.88
P-42259 B 29 73.98
P-42329 A 43 93.94
P-42381 A 37 188.53
P-42634 F 16 7.67
P-42788 C 38 21.88
P-14786 D 22 5.55
P-35146 B 6 62.55
P-11646 D 42 23.58
P-36728 A 15 120.47
P-36826 C 19 18.52
P-36830 B 41 25.29
P-36895 C 11 31.64
P-37009 D 8 23.64
P-37402 C 49 26.02
P-37494 C 1 28.88
P-37504 C 11 13.09
P-37542 B 39 26.43
P-37674 B 17 31.02
P-38033 A 12 70.61
P-38087 B 29 37.76
P-38108 C 44 23.04
P-38247 A 15 128.48
P-38388 C 37 20.84
P-38434 D 49 7.31
P-38460 C 47 28.68
P-38684 B 13 20.30
P-38757 A 30 191.64
P-42792 C 36 17.68
P-42936 A 18 129.79
P-43179 A 47 35.60
P-43264 B 31 103.81
P-43367 B 5 32.39
P-43378 A 46 6.38
P-43622 A 10 155.36
P-43672 A 38 17.97
Here I write the python program for you problem as follow:
Note:Please meke a an extra line in parts.txt file by simply pressing the enter

Sample Output:

parsts.txt file:

RawCode:
f=open("parts.txt",'r') #file
reading
a,b,c,d,un=0,0,0,0,0 #variable initialization
Acost,Bcost,Ccost,Dcost,uncost=0,0,0,0,0
for line in f: #for loop for
iterating each line file
l=line[:-1].split(" ")
#slplitting each line in file separated by space
if"A" in l:
a=a+1
Acost=Acost+float(l[2])*float(l[3])
elif "B" in l:
b=b+1
Bcost=Bcost+int(l[2])*float(l[3])
elif "C" in l:
c=c+1
Ccost=Ccost+int(l[2])*float(l[3])
elif "D" in l:
d=d+1
Dcost=Dcost+int(l[2])*float(l[3])
else:
un=un+1
uncost=uncost+int(l[2])*float(l[3])
print("...................... INVENTORY REPORT
.....................")
print("A parts\t Count:",a,"\tValue of inventory:
%1.2f"%Acost)
print("B parts\t Count:",b,"\tValue of inventory:
%1.2f"%Bcost)
print("C parts\t Count:",c,"\tValue of inventory:
%1.2f"%Ccost)
print("D parts\t Count:",d,"\tValue of inventory:
%1.2f"%Dcost)
print("unknown\t Count:",un,"\tValue of inventory:
%1.2f"%uncost)
------------------------------------------------------------------------------------------------------------
Hope you understand.If you want any modifications commen me,
Upvote me.Thank you.
Write a program to read the parts.txt file and display the cost of inventory for each...
These are my instructions: Your data should have been read in from the data file and stored into an array. Next you need to calculate the following and display in a single Message box: Average score Highest score Lowest score Mode of the scores Your program should be written using methods and should be well documented internally and externally. Your output should be displayed using Message boxes. This is the .text file to use with the instructions: 20 21 22...
Do the Academy Awards involve discrimination based on age? Listed below are the ages of actresses and actors at the times that they won Oscars in the Best Actress and Best Actor categories. the ages are listed in order, beginning with the first Academy Awards ceremony in 1928. (Note: in 1968 there was a tie in the Best Actress category, and the mean of the two ages is used; in 1932 there was a tie in the Best Actor category,...
2. An experiment about a person’s ability to perform some task before and after taking one of the two drugs was conducted. The subjects performed the task that involved mental addition. The subjects were randomly divided into two groups. Each group drank a beverage containing one of two drugs, labeled A, B (placebo). After a period of time for the drugs to take effect, each subject repeated the mental addition test. We want to relate the after test score to...
mips add matrix
Can anyone help me with adding matrix in MIPS?
This is the code given. We will be using it to run it in
spim-cache
Write an assembly code program to perform addition between two matrices A and B, and store the result into a matrix C, i.e, 1 2 3 4 51 [26 27 28 29 301 27 29 31 33 35 6 7 8 9 10 31 32 33 34 35 37 39 41 43 45...
Sample Data Sample Data Hour Sample Taken Hour Sample Taken 1 4 5 X 1 3 1 42 2 3 4 5 6 2 39 36 25 60 28 53 22 56 41 34 43 45 59 42 36 40 45 39 48 26 42 34 61 48 45 29 3 31 61 38 40 54 26 38 42 37 41 53 37 47 41 37 29 20 26 43 38 33 37 37 35 33 36 41 25 37...
You are studying an invasive insect species in the USA.
Understanding where invasive species comes from can help with
management (e.g., importation of native natural enemies for
biocontrol). The graph below shows output from a STRUCTURE analysis
of 10 microsatellite markers in 50 individuals taken from the
invasive US population, and the three native countries of origin,
Spain, France, and Italy. A-1pt) How many genetic groups, or
clusters, were identified in the analysis? Assuming you’ve completely
sampled the native range...
Inferences from Two Samples chapter Listed below are the ages of actresses the awards ceremony, but the ages in and actors at the times that they won the table below are based on the birth Oscars for the categories of Best Actress date of the winner and the date of the and Best Actor. The ages aze listed in awards certmony) chronological otder by row, so that cor- responding locations in the two tables Analyzing the Results are from the...
NUMBER OF PEOPLE 10.2 10.0 10.1 8.5 10.2 8.2 8 Source: United States Census. 11. In the Sanitary District of Chicago, operating engineers are hired on of a competitive civil-service examination. In 1966, there were 223 appl for 15 jobs. The exam was held on March 12; the test scores are s arranged in increasing order. The height of each bar in the histogram next page) shows the number of people with the correspondin examiners were charged with rigging the...
In the graph above which of the following has the largest
molecular size?
1
2
3
4
not enough information to determine
0.35 0.3 o 0.25 o 0.2 20.15 0.1 0.05 CN 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 5354 Fraction
Calculate the range, mean, mode, median, Standard deviation Calculate the skewness and kurtosis for the above data and interpret the data. The following is data collected from the daily salary employees of ZZ COMPANY.. 68 19 43 11 37 30 19 67 65 34 96 23 93 73 46 39 21 12 89 52 33 21 18 57 80 56 91 62 56 48 84 23 78 96 49 36 90 42 65 15 43 36 65 59 34 71...