Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For the following Question use the Matlab IDE: Please use the attached Ssq1.data

ID: 3602228 • Letter: F

Question

For the following Question use the Matlab IDE:

Please use the attached Ssq1.data file to determine delay time, completion time, and waiting time for each customer. Remember the first column of the data represents arrival time, and the 2nd column is service time.

In addition, in case of new additional service, use computer simulations to determine a reasonable increase for the service time that would not impact too much of customer's waiting time. [note: the maximum increase would be the average of all service time provided in he Ssq1.dat] .

Since I cannot post the .dat file, i have pasted the values in the bottom of this page.

12.448 13.919
22.242 4.606
24.509 0.176
33.290 2.030
38.678 11.345
42.211 7.342
46.837 1.511
87.985 6.253
90.686 0.916
97.010 6.101
104.456 7.734
151.104 8.134
151.607 27.840
157.458 12.945
165.072 6.408
173.244 17.631
177.352 6.158
206.365 4.192
209.785 6.428
213.149 1.772
215.979 0.709
233.703 1.751
234.519 2.398
235.677 6.099
251.145 4.672
251.395 5.195
265.614 2.609
269.990 11.686
276.498 7.095
278.624 2.475
284.074 14.376
310.198 0.895
315.127 4.377
316.804 0.976
347.424 5.575
350.186 2.728
350.735 5.352
351.922 5.935
360.410 21.899
365.277 1.110
367.552 2.765
373.862 2.979
376.115 25.656
387.280 1.679
391.381 4.632
396.692 0.851
398.096 0.097
398.764 1.490
399.800 3.328
412.119 7.342
412.585 0.800
431.663 8.265
435.680 15.346
435.913 2.818
440.464 0.143
462.300 13.918
466.235 1.342
477.573 1.717
484.331 0.661
484.760 12.785
502.714 0.950
505.411 4.522
516.540 28.451
524.722 2.316
530.542 2.444
542.416 4.694
556.450 3.849
559.181 1.486
559.396 18.544
606.599 1.809
608.235 5.077
615.216 0.118
616.894 0.017
617.809 1.360
623.105 17.794
642.793 2.556
646.003 2.243
674.011 10.109
681.120 37.535
684.499 10.836
686.016 12.107
718.951 0.319
749.140 19.495
768.518 5.840
769.478 6.404
770.780 8.099
784.759 9.437
785.771 11.019
801.207 15.613
801.690 0.610
802.281 0.782
809.689 17.916
810.809 0.364
835.876 6.426
843.742 6.455
859.724 9.008
866.575 31.793
876.441 3.665
878.542 7.752
889.997 1.099
891.455 8.030
907.078 2.140
923.412 2.323
932.563 0.161
933.579 1.646
952.831 12.502
956.873 6.697
957.529 20.810
972.203 8.197
988.393 4.804
994.804 4.404
1008.648 1.495
1017.846 30.509
1022.584 4.296
1031.972 25.361
1041.543 2.422
1071.267 11.076
1071.324 11.666
1073.053 36.263
1078.872 1.747
1087.717 15.987
1102.080 1.255
1106.871 3.323
1113.460 3.107
1118.413 4.764
1133.018 8.340
1138.476 6.917
1142.877 7.109
1146.211 2.073
1146.902 5.582
1164.288 13.893
1179.410 4.826
1181.149 7.291
1189.167 19.061
1195.348 2.542
1222.971 9.808
1235.558 4.949
1245.730 2.413
1247.449 2.341
1252.148 5.763
1260.021 7.335
1276.570 0.272
1285.124 3.905
1287.862 0.466
1293.366 2.181
1299.550 0.524
1302.613 13.276
1311.318 19.957
1317.201 2.417
1331.776 1.866
1334.608 7.066
1342.614 12.469
1347.325 4.673
1355.507 3.900
1369.712 4.269
1389.059 22.499
1390.303 39.239
1392.456 14.123
1393.665 3.012
1419.282 17.503
1440.944 10.229
1442.996 0.898
1455.226 15.480
1460.752 12.270
1471.717 10.144
1494.709 6.850
1500.472 5.008
1502.254 12.725
1507.072 6.983
1509.833 2.405
1512.534 0.892
1531.641 0.210
1538.447 11.414
1551.443 7.493
1555.011 0.546
1555.890 38.700
1562.907 10.861
1563.349 6.015
1572.153 6.947
1573.876 7.492
1574.850 4.425
1586.057 0.006
1591.652 11.281
1592.506 18.663
1596.964 8.591
1600.226 0.155
1620.736 4.561
1639.220 0.292
1667.020 2.450
1674.652 0.259
1677.211 1.522
1684.311 8.500
1696.531 0.024
1706.059 4.632
1707.396 9.578
1709.301 7.893
1709.445 4.486
1722.357 2.168
1737.399 3.718
1739.147 4.001
1749.582 4.644
1763.367 2.057
1775.868 1.165
1786.319 30.774
1790.727 15.696
1827.787 21.694
1831.030 1.282
1840.449 3.101
1840.465 3.562
1867.680 5.381
1871.026 8.747
1874.971 15.912
1892.384 11.910
1923.820 1.259
1936.975 0.520
1941.436 17.024
1947.920 22.671
1948.779 14.775
1949.612 35.005
1950.139 9.329
1951.399 6.511
1962.067 14.094
1965.343 4.795
1968.872 30.087
1981.111 5.299
1982.265 4.151
1990.458 5.486
1993.308 2.358
2020.780 6.254
2023.302 4.548
2039.730 28.334
2048.650 1.031
2050.595 10.786
2058.531 5.150
2062.195 5.472
2063.682 0.587
2068.237 4.984
2070.633 7.334
2095.647 3.256
2103.246 1.476
2108.529 3.513
2114.128 4.339
2121.259 13.960
2166.664 9.102
2172.786 8.002
2172.924 6.190
2174.849 22.632
2191.455 0.724
2223.026 14.033
2227.218 10.057
2227.986 1.277
2236.633 1.187
2243.187 13.168
2244.437 5.446
2256.290 0.442
2261.154 0.668
2289.275 1.771
2290.129 27.411
2292.916 3.571
2305.559 16.226
2310.152 0.929
2339.963 2.658
2360.332 10.745
2380.767 2.017
2395.684 9.571
2430.183 4.141
2458.420 14.458
2481.141 1.634
2568.124 1.632
2568.245 17.274
2570.846 2.195
2580.086 1.013
2617.010 2.511
2617.182 7.509
2621.899 5.821
2628.812 8.194
2632.267 8.361
2638.197 6.920
2659.938 18.134
2662.680 2.545
2665.522 2.146
2670.559 4.977
2713.901 7.306
2728.373 4.542
2734.890 0.952
2745.710 16.530
2747.990 6.172
2752.759 7.775
2755.925 6.503
2778.514 2.863
2816.152 1.105
2837.874 2.447
2854.855 8.002
2857.209 11.859
2865.301 3.646
2870.969 9.177
2872.510 3.049
2882.771 1.555
2889.702 4.088
2892.917 26.383
2897.600 7.639
2902.423 2.778
2933.639 0.418
2957.061 7.278
2960.221 0.479
2966.866 3.566
2972.176 1.004
2972.231 5.233
2978.085 6.953
2995.347 59.924
2998.975 0.458
3010.083 11.356
3013.871 2.284
3030.484 4.004
3033.330 17.125
3040.840 5.841
3051.620 12.102
3065.911 3.674
3069.830 6.295
3075.381 16.778
3080.610 2.578
3085.048 5.769
3093.813 2.814
3103.785 20.616
3107.468 5.710
3131.818 10.538
3134.167 1.917
3134.655 2.254
3165.853 9.149
3175.858 1.036
3215.291 1.708
3226.279 10.627
3244.733 0.974
3252.022 5.826
3261.051 2.013
3275.341 20.020
3278.600 11.992
3282.437 9.543
3283.595 8.111
3296.041 9.155
3306.993 4.061
3311.464 6.628
3315.567 5.627
3326.758 1.945
3327.695 3.501
3332.882 9.293
3362.646 1.848
3363.021 17.768
3368.621 15.903
3373.410 20.983
3384.853 0.742
3386.151 11.023
3392.451 4.936
3395.294 1.344
3402.929 8.683
3403.930 1.904
3405.474 19.994
3407.449 4.619
3408.485 1.835
3419.331 4.016
3430.082 4.565
3434.005 1.962
3447.847 5.122
3450.180 12.060
3465.487 0.862
3476.081 5.830
3476.685 16.593
3488.071 2.174
3496.933 23.697
3508.139 2.217
3528.743 9.808
3528.848 20.466
3535.994 8.859
3555.755 5.392
3557.904 4.175
3569.165 11.045
3570.873 4.897
3577.630 0.065
3583.907 3.604
3584.559 14.643
3592.723 8.371
3593.624 1.855
3615.041 22.627
3617.827 3.073
3624.490 7.908
3626.027 3.836
3643.208 9.045
3662.680 0.615
3694.690 6.454
3704.401 6.807
3715.857 35.328
3728.581 5.766
3739.913 0.744
3742.693 11.143
3742.904 6.601
3745.574 5.847
3758.270 3.607
3773.404 15.209
3809.558 12.304
3815.535 6.346
3819.223 0.219
3825.904 7.630
3826.597 13.557
3846.157 0.066
3855.261 7.784
3856.628 6.027
3862.660 4.555
3866.386 6.758
3883.776 0.656
3917.567 1.958
3920.453 0.702
3967.643 0.078
4010.438 2.058
4010.872 0.208
4036.713 7.479
4048.693 5.701
4054.953 13.208
4064.685 1.083
4079.594 10.197
4097.814 2.807
4149.175 1.360
4152.011 5.305
4166.792 9.719
4188.290 20.234
4188.670 5.445
4191.268 0.043
4193.254 4.451
4194.876 5.943
4200.758 35.321
4209.418 4.257
4217.684 2.942
4218.418 4.570
4226.859 24.844
4246.799 12.220
4266.233 14.635
4296.574 2.664
4300.680 8.727
4304.514 3.688
4364.483 1.774
4374.005 0.530
4401.523 5.212
4403.301 7.605
4420.895 12.087
4448.917 1.499
4451.074 0.003
4454.356 6.982
4456.034 2.457
4457.128 8.125
4458.516 2.260
4468.818 1.987
4471.457 5.240
4474.799 2.846
4475.647 1.115
4483.728 22.121
4505.270 5.872
4513.734 6.101
4548.300 20.977
4567.357 3.608
4579.691 0.276
4592.563 2.904
4596.585 0.667
4607.302 0.394
4620.903 14.784
4640.599 1.766
4647.289 0.757
4654.869 5.570
4661.389 1.566
4706.668 4.158
4711.472 1.245
4725.344 1.199
4739.002 1.589
4756.595 5.192
4766.450 9.350
4777.937 4.187
4784.645 1.775
4793.678 1.006
4800.785 13.823
4815.235 22.815
4826.984 1.375
4835.115 5.512
4839.669 12.784
4850.627 28.381
4850.740 8.675
4874.295 16.399
4879.896 4.167
4883.805 19.301
4884.691 7.855
4901.622 3.151
4903.705 3.042
4903.781 4.601
4906.506 6.401
4907.840 8.686
4917.715 1.166
4924.438 9.601
4931.095 4.986
4935.204 1.838
4939.280 3.422
4943.939 0.821
4947.963 0.015
4950.295 4.659
4975.575 5.827
4983.211 14.113
5000.520 1.350
5020.355 8.736
5021.759 5.673
5035.086 11.490
5054.045 11.073
5057.151 1.158
5062.496 0.233
5063.203 5.968
5068.955 3.454
5073.239 3.688
5092.908 20.302
5095.228 0.049
5106.454 4.530
5109.299 5.024
5110.354 3.026
5112.300 2.754
5126.842 0.404
5139.129 1.573
5145.215 1.044
5164.767 1.481
5178.465 2.447
5186.885 5.045
5212.926 10.137
5226.727 0.912
5242.655 0.275
5275.301 12.028
5278.302 2.217
5303.249 0.598
5307.802 3.788
5310.020 5.141
5321.862 3.626
5333.834 3.907
5336.996 0.088
5348.343 1.069
5348.826 1.883
5352.086 1.227
5353.362 13.357
5356.584 2.934
5358.566 20.462
5385.414 1.292
5388.864 10.366
5401.903 1.725
5404.859 20.645
5409.882 6.740
5421.201 27.308
5424.337 4.192
5424.751 1.977
5429.051 2.833
5439.976 6.282
5449.649 2.071
5457.213 2.188
5498.054 53.407
5503.487 6.054
5510.583 7.751
5518.106 18.203
5545.574 0.804
5545.626 3.746
5558.850 15.386
5567.884 0.694
5579.342 8.434
5582.619 6.437
5594.899 10.027
5602.462 6.913
5603.404 3.759
5620.895 13.161
5622.831 8.936
5625.214 8.989
5631.807 3.464
5637.898 2.683
5663.697 2.922
5687.230 3.031
5695.150 1.046
5695.984 22.087
5712.539 27.253
5712.683 4.356
5731.949 1.181
5750.833 12.718
5755.506 15.770
5760.552 8.596
5770.192 1.833
5776.490 15.494
5781.058 6.870
5788.675 0.472
5796.897 0.207
5804.424 6.362
5816.043 0.153
5816.852 5.443
5823.790 0.298
5831.588 19.063
5846.280 6.120
5856.966 12.683
5880.801 19.564
5884.385 3.231
5887.530 14.637
5898.554 12.978
5904.058 0.360
5916.996 1.519
5918.698 1.887
5919.994 0.432
5945.865 4.140
5946.000 8.411
5946.903 6.888
5947.603 5.137
5950.823 4.671
5957.539 1.028
5959.979 13.968
5974.192 17.445
5975.129 24.132
5993.470 14.824
5998.496 10.818
6003.131 16.664
6032.899 7.173
6036.317 9.015
6057.984 10.198
6063.188 0.503
6085.369 1.841
6113.047 4.991
6122.227 11.223
6124.860 0.283
6137.064 2.078
6158.126 6.037
6161.078 11.055
6178.359 8.572
6197.080 1.552
6198.676 13.216
6206.595 13.345
6226.448 14.056
6228.787 3.784
6239.263 5.574
6267.010 10.108
6270.849 6.350
6284.535 2.954
6305.730 8.125
6307.838 39.690
6313.413 19.848
6316.432 2.736
6324.701 5.337
6334.071 13.590
6365.614 15.956
6374.737 5.332
6379.875 17.388
6388.646 3.639
6397.487 5.785
6405.153 2.622
6421.327 1.234
6426.982 0.221
6443.614 7.127
6444.562 4.545
6448.993 17.504
6450.616 7.197
6458.729 1.209
6471.247 1.582
6486.383 6.344
6486.542 3.909
6487.979 6.184
6502.730 4.780
6506.457 1.749
6513.252 8.579
6521.363 4.796
6530.106 0.317
6548.365 16.841
6553.406 5.881
6564.469 7.457
6569.957 0.735
6574.468 0.731
6576.904 2.741
6594.839 7.192
6605.245 1.450
6609.792 1.993
6610.352 19.383
6610.687 3.518
6614.722 3.802
6617.325 14.886
6626.320 3.892
6634.040 9.293
6652.546 17.921
6655.430 2.864
6661.250 8.996
6663.739 1.124
6664.001 31.558
6688.775 16.347
6694.265 5.373
6694.677 11.386
6699.663 2.257
6700.303 5.339
6729.463 14.672
6741.877 0.697
6760.492 4.192
6762.214 0.029
6772.088 12.279
6789.373 0.104
6797.921 7.636
6800.896 2.701
6801.319 3.835
6803.948 9.582
6841.294 6.796
6856.967 29.227
6870.373 27.245
6878.335 1.708
6886.588 12.411
6893.696 5.248
6894.754 6.539
6900.410 13.864
6909.207 9.530
6912.324 1.821
6920.043 7.384
6966.861 2.968
6977.826 6.646
6994.586 0.515
6996.047 2.322
7047.945 3.014
7051.064 0.132
7053.545 1.032
7054.525 2.282
7056.775 6.430
7063.293 0.953
7072.759 1.512
7074.828 12.886
7088.138 3.619
7088.503 5.334
7094.147 2.472
7095.845 5.769
7111.307 0.258
7112.877 5.101
7141.980 9.374
7144.095 0.647
7157.722 14.384
7172.060 2.768
7189.000 1.643
7195.859 1.184
7196.047 0.374
7197.521 30.138
7212.569 10.145
7216.895 8.349
7217.806 2.745
7219.657 8.246
7229.371 9.174
7232.213 3.597
7237.140 13.729
7242.210 8.213
7275.109 13.483
7286.855 11.309
7293.129 5.713
7320.843 3.184
7328.010 2.659
7338.282 9.217
7345.209 4.601
7347.969 12.989
7348.515 4.643
7371.483 4.705
7382.656 2.172
7384.448 0.151
7387.482 17.014
7389.550 2.250
7403.956 2.898
7406.271 7.877
7407.358 4.572
7415.023 11.704
7416.554 18.742
7440.018 4.192
7446.916 7.582
7449.592 10.109
7471.360 29.346
7472.795 0.785
7479.318 0.430
7479.744 2.017
7521.834 1.914
7527.260 3.422
7556.018 5.871
7596.476 20.758
7603.198 3.182
7609.869 6.487
7635.355 13.201
7657.851 17.263
7672.290 6.610
7673.664 14.039
7680.106 0.177
7690.793 8.685
7697.009 19.581
7698.643 1.734
7699.954 9.075
7731.403 0.881
7779.301 2.252
7780.498 3.698
7782.666 6.299
7813.983 4.975
7835.052 0.205
7836.501 5.539
7847.214 2.945
7851.851 21.928
7883.837 22.140
7884.721 8.559
7907.501 5.312
7923.419 11.642
7933.128 1.385
7953.971 2.796
7979.301 1.859
7979.425 17.139
7992.623 5.244
7994.504 3.809
8008.613 6.434
8009.741 4.001
8010.139 0.042
8016.198 3.676
8018.649 0.706
8018.655 4.063
8021.009 1.503
8054.623 0.194
8065.171 10.645
8080.135 4.228
8089.806 5.639
8100.228 11.616
8110.251 22.839
8113.048 2.620
8123.723 4.892
8148.499 1.171
8161.434 10.382
8170.403 10.366
8226.369 7.649
8234.056 1.598
8240.851 0.484
8243.890 7.899
8256.493 0.083
8258.486 5.882
8319.992 1.351
8336.137 9.810
8340.066 7.396
8352.573 1.611
8371.431 2.066
8382.397 5.322
8385.437 31.713
8385.593 0.749
8413.377 7.592
8426.180 2.028
8429.750 12.959
8452.818 2.613
8467.868 5.252
8477.880 2.395
8500.472 9.358
8510.511 18.825
8512.094 2.350
8520.682 1.643
8531.915 0.593
8532.580 12.574
8544.529 0.248
8548.808 1.471
8558.749 9.956
8566.755 4.910
8571.031 15.687
8577.829 3.121
8593.072 16.684
8614.483 11.216
8625.283 3.788
8625.704 14.534
8631.682 1.939
8633.588 1.976
8637.252 11.714
8662.053 7.909
8665.732 14.272
8671.365 15.338
8685.971 1.919
8698.504 12.776
8700.000 7.456
8709.347 0.084
8710.809 1.538
8733.997 3.053
8746.083 0.021
8746.891 1.019
8749.453 2.170
8791.641 7.962
8802.002 4.561
8803.956 9.653
8804.901 0.351
8810.678 2.341
8822.334 18.458
8834.894 6.859
8837.261 5.266
8838.317 0.895
8840.927 3.344
8852.833 1.007
8870.022 1.971
8882.308 4.300
8887.237 1.152
8890.209 4.324
8900.798 5.813
8901.902 5.141
8909.554 4.591
8914.239 4.049
8940.146 27.174
8943.341 6.106
8954.926 2.536
8964.798 5.325
8966.354 2.203
8969.607 3.770
8979.248 2.349
8979.655 14.324
8980.008 2.034
8986.260 16.717
9010.738 3.941
9027.741 8.738
9038.970 0.337
9042.974 20.606
9062.615 2.479
9066.878 4.084
9085.027 14.610
9085.209 1.999
9085.641 3.490
9086.935 4.547
9091.470 2.931
9092.635 26.164
9102.004 5.247
9102.010 11.441
9102.604 10.831
9106.637 2.500
9113.168 16.237
9118.077 1.049
9129.609 0.234
9140.089 0.773
9144.821 8.609
9160.102 16.493
9180.962 24.070
9184.329 0.147
9188.190 6.865
9197.194 4.254
9205.706 0.319
9209.975 16.550
9263.085 0.165
9272.852 3.541
9277.675 0.868
9301.100 0.908
9301.582 0.853
9302.696 1.582
9306.811 1.520
9316.507 2.752
9318.021 0.783
9331.601 5.521
9347.404 2.536
9351.081 4.522
9353.039 2.826
9369.213 3.234
9397.381 0.022
9398.892 5.450
9412.434 0.938
9414.571 8.803
9415.766 1.817
9428.053 1.985
9452.375 8.367
9472.245 7.749
9476.428 12.516
9477.728 4.258
9480.676 6.429
9483.910 0.004
9486.880 0.845
9492.704 7.339
9514.942 7.097
9515.883 0.907
9528.367 1.211
9559.658 6.302
9577.121 8.661
9578.188 1.772
9584.435 3.447
9597.574 6.825
9621.184 7.737
9621.585 9.114
9622.876 1.641
9630.237 4.152
9638.074 0.213
9638.239 2.341
9655.737 10.162
9658.437 4.808
9659.516 11.505
9660.278 3.679
9661.462 6.564
9666.341 10.750
9669.367 4.167
9683.422 2.500
9695.885 11.782
9701.407 2.312
9703.313 1.319
9709.511 9.483
9727.932 4.759
9749.769 0.986
9752.642 7.933
9753.017 2.144
9757.641 8.072
9758.991 2.933
9779.261 24.863
9783.530 0.212
9795.271 11.615
9795.666 9.962
9801.527 0.271
9808.463 2.856
9812.555 4.009
9815.063 12.053
9821.954 1.465
9849.789 24.010
9865.046 16.084
9872.038 7.334

We need to put all of this data into a .dat file and read it in through Matlab and compute it

Explanation / Answer

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
int i_temp=0;
char* pointer_stop;
int val =0;
char binary[50000][12];
char binary_string[50000];
int length=0;
int error=0;
char input[50000];
char lowercase[50000];
char chksm[50000];
char tester[50000];
char string_end[50000];
char *polynomial;

//HEX-BINARY
void HEXA_BIN(char *hexaDecimal)
{
long int i=0;
char block[5];
while(hexaDecimal[i])
{
switch(hexaDecimal[i])
{
case '0':
strcpy(block, "0000");
break;
case '1':
strcpy(block, "0001");
break;
case '2':
strcpy(block, "0010");
break;
case '3':
strcpy(block, "0011");
break;
case '4':
strcpy(block, "0100");
break;
case '5':
strcpy(block, "0101");
break;
case '6':
strcpy(block, "0110");
break;
case '7':
strcpy(block, "0111");
break;
case '8':
strcpy(block, "1000");
break;
case '9':
strcpy(block, "1001");
break;
case 'a':
strcpy(block, "1010");
break;
case 'b':
strcpy(block, "1011");
break;
case 'c':
strcpy(block, "1100");
break;
case 'd':
strcpy(block, "1101");
break;
case 'e':
strcpy(block, "1110");
break;
case 'f':
strcpy(block, "1111");
break;
}
i++;
strcat(binary_string, block);
}
}
void CrcChecker()
{
int i,p;
int c;
for(i=0; i<strlen(polynomial); i++)
chksm[i]= binary_string[i];
do
{
if(chksm[0]=='1')
{
for(c = 1; c < strlen(polynomial); c++)
{
if (chksm[c] == polynomial[c])
{
chksm[c] = '0';
}else chksm[c] = '1';
}
}
for(p=0; p<strlen(polynomial)-1; p++)
chksm[p]=chksm[p+1];
chksm[p]=binary_string[i++];
}
while(i<=length+strlen(polynomial)-1);
}

//BINARY-HEX
void BIN_HEXA(char *binary)
{
long int dec;
long int rm;
long int qt;
int i=1,j,temp;
char hx[50000];
dec = strtol (binary,NULL,2);
qt = dec;
while(qt!=0)
{
temp = qt % 16;
if( temp < 10)
{
temp =temp + 48;
}else temp = temp + 55;
hx[i++]= temp;
qt = qt / 16;
}
for(j = i -1 ; j> 0; j--)
printf("%c",hx[j]);
printf(" (hex)");

}

//MAIN
int main(int argc, char *argv[])
{
int i=0,e=0;
int i_line=0;
polynomial="1101";
polynomial="1100110110101";
int spacer=0;

strcpy(input, argv[2]);
printf("----------------------------------------------------------------------- ");


//CHOOSE CALC MODE
if (strcmp(argv[1], "c") == 0)
{
printf("The input string (hex): %s ", input);

for(i = 0; i<strlen(input); i++)
{
lowercase[i] = tolower(input[i]);
}
HEXA_BIN(lowercase);
printf("The input string (bin): " );

for(i=0; i<strlen(input)*4; i++)
{
printf("%c" , binary_string[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf(" ");
printf(" ");
printf("The polynomial that was used (binary bit string): ");
for(i=0; i<strlen(polynomial); i++)
{
printf("%c" , polynomial[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf(" ");
printf("Mode of operation: calculate ");
printf(" ");
printf("Number of zeroes that will be appended to the binary input : 12 ");
printf(" ");
printf("The binary string difference after each XOR step of the CRC calculation: ");
length = strlen(binary_string);
for(i=strlen(binary_string); i<(strlen(polynomial) + length) - 1; i++)
{
binary_string[i]='0';
}
//Calculate(binary_string, polynomial);
CrcChecker();
printf(" ");
i_line=0;
if (strlen(chksm) % 4 == 0)
{
printf("The CRC computed from the input : ");
for(i=0; i<strlen(chksm); i++)
{
printf("%c" , chksm[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf("(bin) = ");
BIN_HEXA(chksm);
printf(" ");
}
else
{
i_line=0;
printf("The CRC computed for the input is: 0");
for(i=0; i<strlen(chksm); i++)
{
printf("%c" , chksm[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf("(bin) = ");
BIN_HEXA(chksm);
printf(" ");
}
printf(" ");
}

//CHOOSE VERIFY MODE
else if (strcmp(argv[1], "v") == 0)
{
printf("The input string (hex): %s ", input);
for(i = 0; i<strlen(input); i++)
{
lowercase[i] = tolower(input[i]);
}
HEXA_BIN(lowercase);
printf("The input string (bin): " );
for(i=0; i<strlen(input)*4; i++)
{
printf("%c" , binary_string[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf(" ");
printf(" ");
printf("The polynomial that was used (binary bit string): ");
for(i=0; i<strlen(polynomial); i++)
{
printf("%c" , polynomial[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf(" ");
printf(" ");
printf(" Mode of operation: verification ");
printf(" The CRC observed at the end of the input: ");
i_line=0;
i_temp=0;
for(i=strlen(binary_string) - 12; i<strlen(binary_string); i++)
{
printf("%c" , binary_string[i]);
string_end[i_temp]=binary_string[i];
i_temp++;
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf("(bin) = ");
BIN_HEXA(string_end);
printf(" ");

length = strlen(binary_string);
for(i=strlen(binary_string) - 12; i<strlen(binary_string); i++)
{
binary_string[i]='0';
}
length = strlen(binary_string)-12;
CrcChecker();
printf(" ");

printf("The binary string difference after each XOR step of the CRC calculation: ");
i_line=0;
if (strlen(chksm) % 4 == 0)
{
printf("The CRC computed for the input : ");
for(i=0; i<strlen(chksm); i++)
{
printf("%c" , chksm[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf("(bin) = ");
BIN_HEXA(chksm);
printf(" ");
}
else
{
i_line=0;
printf("The CRC computed for the input : 0");
for(i=0; i<strlen(chksm); i++)
{
printf("%c" , chksm[i]);
i_line++;
if(i_line == 4)
{
i_line = 0;
printf(" ");
}
}
printf("(bin) = ");
BIN_HEXA(chksm);
printf(" ");
}
printf(" ");
if(strcmp(chksm,string_end) == 0)
{
printf("Did the CRC check pass? (Yes or No): Yes ");
}
else
{
printf("Did the CRC check pass? (Yes or No): No ");
}
}
}