Ae Me
Sb Ae
D Oc 12 b 11:59pm P 100 Sb a file pload F T ip Aaab Sep 23 a 8am – Oc 14 a 11:59pm 22 da
Idc
In hi aignmen, o’ll ie a pogam ha ill inodce o o pogamming in C on UNIX baed em.
Lea Oce
Ho o ie a C pogam o ole a poblem? (Modle 1 MLO 4)
Ho do o ineac ih he e in C pogam? (Modle 1 MLO 6)
Ho ae C pogam anfomed ino an eecable fom? (Modle 1 MLO 7) Define pogamming langage conc in C (Modle 2 MLO 1)
Decibe ce daa pe of C pogamming langage (Modle 2 MLO 3) Wha ae poine and ho i hi mechanim ppoed in C? ((Modle 2 MLO 4) Decibe memo allocaion in Uni (Modle 2 MLO 5)
Eplain ho o ceae and maniplae ing in C (Modle 2 MLO 6)
Ic
Wie a pogam ha
Read a CSV file ih moie daa ha i poided o he pogam a an agmen Pocee he daa in he file o ceae c o hold daa fo each moie Ceae a linked li of all hee c
Gie e choice o ak eion abo he moie in he daa
Pin o he daa abo he moie pe e choice
Fa f e CSV Fe
Hee i a a hoe foma coepond o he foma of he CSV file o pogam ill be eed ih.
The fi o in he file conain he colmn heade, and no moie daa.
All ohe o hae he ame foma and no colmn ae miing in an o.
Comma appea a delimie beeen colmn, b ill no appea in he ale of an colmn.
Thi file ha he folloing colmn:
1. Tile
Thi i a ing ih he moie ile.
E.g., Ion Man 2 2. Yea
Thi i a 4 digi inege ale fo he ea he moie a eleaed E.g., 2010
3. Langage
The langage o langage in hich he moie a eleaed. One o moe ing ale ha ae ala encloed ihin [] Mliple ale ae epaaed b emi-colon.
E.g,
[Englih;Pogee;Spanih] [Englih;Fench]
[Englih]
Yo can ame ha he maimm nmbe of langage an moie can be eleaed in i 5.
Yo can ame ha he maimm lengh of a langage ing i 20 chaace. 4. Raing Vale
A nmbe beeen 1 and 10 (inclie of boh 1 and 10)
I can be an inege o a doble ih one digi afe he decimal poin E.g.,
5 8.7
Program Fnconai
Proce he inp fie
When o pogam a i m ead all daa fom he file and poce i. Afe poceing he file, he pogam m pin he folloing meage o do
“Poceed file XYZ and paed daa fo M moie”
hee XYZ i he name of he file ha ha been poce and M i he nmbe of moie hoe daa ha been poceed (hi ill be 1 le han han he nmbe of line in he file becae he fi line ha he colmn heade).
E.g., Poceed file moie_ample_1.c and paed daa fo 24 moie
Inerace Fnconai
Ne o pogam hold dipla a men of ineacie choice o he e and poce he eleced choice a decibed belo. Fo he e of meage o pin, ee he ecion “Sample Pogam Eecion.”
1. Sho moie eleae in he pecified ea
If he e chooe hi opion, hen ak hem o ene a ea and
Dipla he name of all he moie eleaed in ha ea, one on each line
Yo pogam can ame ha he e ill ene a 4 digi inege fo he ea
If he daa doen’ hae an moie eleaed in ha ea, pin a meage abo hi.
2. Sho highe aed moie fo each ea
If he e chooe hi opion, hen fo each ea fo hich a lea one moie a eleaed, dipla a moie ha had he highe aing along ih he ea and he aing ih one line pe ea.
In cae of ie, dipla an one moie ha had he highe aing ha ea. Dipla he daa in he fom: YYYY RaingVale MoieTile
The daa doen’ hae been oed b ea o b aing ale.
E.g.,
2010 8.5 Aenge: Infini Wa 2012 8.1 The Aenge
3. Sho moie and hei ea of eleae fo a pecific langage
If he e chooe hi opion, ak hem o ene a langage and
Fo all moie eleaed in he pecified langage
Dipla he ea of eleae and he moie ile, one line pe moie
If he daa doen’ inclde an moie eleaed in hi langage, pin a meage abo i. 4. Ei
If he e chooe hi opion, he pogam hold ei. Noe:
Yo can ame ha hen he pogam ak e o ene an inege, he e ill indeed ene an inege (i.e., o don’ need o eif he daa pe of he e inp).
Fo he ineacion choice if he e ene an incoec inege (i.e., omehing ohe han 1 o 4), pin an eo meage and again peen he 4 choice o he e.
Technica Reiemen
Yo pogam i eied o
1. Read daa fom he file line b line
2. Beak-p he line ino oken
3. Ceae a c called ih he daa fo ha line 4. Ceae a linked li conaining all he moie ce
In he Reoce Secion e hae poided ample code ha o can adap o mee hee echnical eiemen.
Sampe Pogam Eecon
Hee i a complee eample of eecing he aignmen ih he poided ample CSV file.
Cc (S 28): The aignmen decipion ak aing o be diplaed ih 1 decimal poin. B he ample op dipla moie aing ih 2 decimal poin. Thi i an eo in he ample op. Gien ha ome of o ma alead hae coded he aignmen, e ill accep moie aing diplaed ih eihe 1 o 2 decimal poin (o i i o choice).
$ ./ 1.
P 1. 24
1.
2.
3.
4. E
E 1 4: 1
E : 1999
N 1999
1.
2.
3.
4. E
E 1 4: 1
E : 2012
A
R G
A K
1.
2.
3.
4. E
E 1 4: 2
2008 7.90 I M
2009 7.60 H
2010 7.00 I M 2
2013 7.20 I M 3
2017 7.90 : R
2012 8.10 A
2016 7.80 C A: C
2018 8.50 A: I
2015 7.40 A: A
2011 7.00
2014 7.80 C A:
2003 6.60 R
1.
2.
3.
4. E
E 1 4: 3
E : E
2008 I H
2009 H
2008 I M
2010 I M 2
2013 I M 3
2017 : R
2012 A
2016 D
2018 A: I
2015 A: A
2011
2013 : D
2017 -M: H
2011 C A: F A
2016 C A: C
2015 A-M
2014 C A:
2018 M Q
2016 R R P O
2017 G C
2016 F F
2003 R
2012 R G
2012 A K
1.
2.
3.
4. E
E 1 4: 3
E : P
N P
1.
2.
3.
4. E
E 1 4: 5
. .
1.
2.
3.
4. E
E 1 4: 4
$
Hin
Code he fncionali incemenall, conanl eing i and ing eion conol (e.g., Gi) o ack change.
Yo can e he Gading Rbic a a gide o incemenall deelop he fncionali.
To cone a ing o in, o can e he fncion a (://a7.//a-a/a3/a.3.) .
To cone a ing o a doble, o can e he fncion (://a7.//a- a/a3/.3.) .
To eac oken fom a ing, e _ (://a7.//a-a/a3/_.3.) inead of ok.
To pin a aiable of daa pe doble o one decimal pace, e “%.1f” fo hi aiable in he foma ing paed o (://a7.//a-a/a1/.1.) .
Reorce
We hae poided an eample pogam a.c (://./@c344/c#a.c) ha ead a pace delimied e file ih den daa, pocee i line b line, ceae a linked li of den c ih ha daa and hen pin ha daa.
In o aignmen, o can e and adap an code fom hi pogam and alo an code peened in he eploaion.
A ample file ih den info ha o can e ih hi pogam i aailable (://./@c344/c#_1.) .
Yo can compile and n he pogam b ing he folloing command:
–=99 - .
./ 1.
What to turn in?
Yo can onl e C fo coding hi aignmen and o m e he gcc compile.
Yo can e C99 o GNU99 andad o he defal andad ed b he gcc inallaion on o1.
Yo aignmen ill be gaded on o1.
Sbmi a ingle ip file ih all o code, hich can be in a man diffeen file a o an.
Thi ip file m be named ORONID1. hee YOURONID hold be eplaced b o on ONID.
E.g., if chadhn a bmiing he aignmen, he file m be named 1. .
In he ip file, o m inclde a e file called README. ha conain incion on ho o compile o code ing gcc o ceae an eecable file ha m be named .
When o ebmi a file in Cana, Cana can aach a ffi o he file, e.g., he file name ma become
1-1. . Don’ o abo hi name change a no poin ill be dedced becae of hi. Grading Criteria
Thi aignmen i oh 7% of o final gade.
100 poin ae aailable fo he aignmen and he beak-p fo iem i decibed in he gading bic. The gading ill be done on o1 b nning he pogam again one o moe CSV file ha hae he eac foma of he ample CSV file b ih diffeen daa.
A 1 M
Ca
Ra
P
Meage abo poceed file and moie i coec
15.0 F Ma
0.0 N Ma
15.0 p
“Sho moie eleaed in he pecified ea” ok coecl
15.0 F Ma
0.0 N Ma
15.0 p
“Sho highe aed moie fo each ea” ok coecl
20.0 F Ma
0.0 N Ma
20.0 p
“Sho he ile and ea of eleae of all moie in a pecific langage” ok coecl
20.0 F Ma
0.0 N Ma
20.0 p
The pogam ei onl hen e ene he coec choice
4.0 F Ma
0.0 N Ma
4.0 p
Top leel choice ohe han 1 o 4 i coecl handled
1.0 F Ma
0.0 N Ma
1.0 p
The aignmen bmiion follo he diecion.
5.0 F Ma
The ip file i named coecl. A README. file i inclded in he ip file ih diecion on ho o compile he code. Rnning he diecion in he README. file ceae an eecable named moie.
0.0 N Ma
ip file i incoecl named and/o he README. file i miing and/o he README. file doen’ inclde alid incion o ceae an eecable named moie
5.0 p
The code i ell- commened
5.0 >0.0 F Ma
0.0 N Ma
5.0 p
The pogam mee he echnical eiemen of poceing he file line b line
5.0 F Ma
0.0 N Ma
5.0 p
The pogam mee he echnical eiemen of defining and ing an appopiae moie c fo he daa of a moie
5.0 F Ma
0.0 N Ma
5.0 p
Ca
Ra
P
The pogam mee he echnical eiemen of ing a linked li fo all he moie c
5.0 F Ma
0.0 N Ma
5.0 p
Toal Poin: 100.0