Starting from:
$30

$24

Homework #4 Solution

For this homework, you will work independently to solve one problem in two programming languages, Python 3 and C#.

Your program files will be called hw4.py and hw4.cs, respectively.




Part of the grading for this assignment will be based on your usage of Python 3 and C# features and data structures that are appropriate to the problem. In particular you should utilize language features that make your program shorter, more readable, and/or more reliable.




Submit a zip archive that contains your two files: hw4.py and hw4.cs.




Mail merge program. You will write two equivalent programs: one in Python 3 and one in C#. They will be invoked on ceclnx01 as shown here:




python3 hw4.py a.tsv a.tmp



mcs hw4.cs
mono hw4.exe a.tsv a.tmp



where hw4.exe is your compiled C# code. The first command line argument is a tab separated file of records -- a.tsv (tsv stands for “tab separated values). The second one is a form letter with embedded codes -- a.tmp. Sample .tsv and .tmp files are provided in the archive TestFiles.zip in Canvas - Files - Homework Assignments - HW4 (Note: matching files have matching names: b.tsv and b.tmp; c.tsv and c.tmp, etc.).




Here are the contents of the a.tsv file:




NAME
ID


COURSE
DUE




SUBMITTED
MINUTESLATE
Steve Smith
smiths


465
2/5/2016 23:59:00
2/6/2016 0:45:00
46


Mark Watson
watsonm


465
2/5/2016 23:59:00
2/6/2016 3:47:00
228


Kenny Briddle
briddlek


465
2/5/2016 23:59:00
ontime
0


Bill Haygood
haygoodb
565
2/5/2016 23:59:00
ontime
0


(continuation)


















LATEDEDUCTION
P1
P1COMMENTS


P2
P2COMMENTS
SUBTOTAL
TOTAL
1


35
Excellent work


65
Nice


100
99
5


30
Test case 10 provides
65
Well done
95
90






incorrect output;


















otherwise, nicely done.










0


15
Many test cases missing.
55
Missing the report.
70
70
0


0
Not attempted


65
Nice


65
65



Here are the contents of the a.tmp file:




Name: <<NAME (<<COURSE)

ID: <<ID

Total: <<TOTAL/100 Subtotal: <<SUBTOTAL Total deductions:

<<LATEDEDUCTION




Time due: <<DUE

Submitted: <<SUBMITTED

Late minutes: <<MINUTESLATE

Late deduction: <<LATEDEDUCTION




Problem 1: <<P1/35

<<P1COMMENTS

Problem 2: <<P2/65

<<P2COMMENTS




When run, your program should produce one output file for each record in the file. The file should be named using the ID column. In this case, the four files should be smiths.txt, watsonm.txt, etc. Here is one of the output files:




Name: Steve Smith (465)

ID: smiths

Total: 99/100 Subtotal: 100










Total deductions: 1



Time due: 2/5/2016 23:59:00

Submitted: 2/6/2016 0:45:00

Late minutes: 46

Late deduction: 1




Problem 1: 35/35

Excellent work




Problem 2: 65/65

Nice




Notes:




All columns in the tsv file will have a unique name.
One of the tsv columns will have the name ID.
Any string inside the tmp file having the form <<letters+ is considered a tag.



The field values in the tsv file may contain << and . These values are to be treated literally and not to be substituted as a tag.

More products