ICP Documentation

download ICP Documentation

of 39

Transcript of ICP Documentation

  • 8/9/2019 ICP Documentation

    1/39

    ICP Assignment

    ASSIGNMENT

    TECHNOLOGY PARK MALAYSIA

    CT018-3-1 ITCP

    INTRODUCTION TO C PROGRAMMING

    UC1130!IT

    N"me # Lim Keng Li"ng

    TP$ N% # TP0&80'&

    LECTURER # Ms$ S()*i+" Sing,

    HAND OUT DATE # & N%em.e* &013

    HAND IN DATE # &/ e.*("*+ &01/

    ICP Assignment P"ge 1

  • 8/9/2019 ICP Documentation

    2/39

    ICP Assignment

    ContentsCT018-3-1 ITCP$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$1

    INTRODUCTION TO C PROGRAMMING$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$1

    Int*%(ti%n$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ /

    Ass(m)ti%ns$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ /

    P*%g*"m Design 2Pse(%%e An %4,"*t5$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!

    i$ 6%i m"in25$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$!

    ii$ 6%i "t"ent*+25$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$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$$$$$31

    Hanly, J. R., Koffman, E. B. and Friedman, F. L.$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$31

    ICP Assignment P"ge &

  • 8/9/2019 ICP Documentation

    3/39

    ICP Assignment

    IntroductionThis system was designed for the administrative staffs at a local boo lending sho!,

    which had diffic"lties with their c"rrent system. #t was diffic"lt to manage and add newbooings, es!ecially when the staff wants to trac a s!ecific boo of choice. The organi$ation

    wants to im!rove its services by im!lementing an a"tomatic boo loan service, which is easy and

    convenient for staff to access and "se. #t is able to im!rove b"siness o!erations as an overall

    res"lt and !erha!s gain more c"stomers for the boo lending sho!, given that the !rogram is

    f"nctional well.

    AssumptionsBased on the !rogram b"ilt, it is safe to ass"me that the "ser has to ey in the correct data

    in!"t, as there is no data validation of any ty!e b"ilt into the !rogram. The second ass"m!tion is

    that "sers will have to ey in a "ni%"e #& as there is also no data validation to whether the #&

    was registered or not. This is beca"se each data in!"t has to be "ni%"e for the delete'edit'view

    f"nction to wor( otherwise the data will be overla!!ed. )e*t, we can also ass"me that the boos

    in the library are inserted into the database by the staff is correct as there is no method to

    add'delete boos "sing this !rogram c"rrently. Finally, it is also safe to say that this system is not

    !erfect and has many errors that may occ"r.

    ICP Assignment P"ge 3

  • 8/9/2019 ICP Documentation

    4/39

    ICP Assignment

    Program Design (Pseudocode And Flowchart

    i! "oid main(

    Begin

    &eclare newloan, view, del, "!date, e*it

    +rint -elcome to "r /"tomated Library Loan 0ystem1

    +rint 2ain 2en"1

    +rint 3. )ew Loan1

    +rint 4. 5iew E*isting Loan1

    +rint 6. &elete E*isting Loan1

    +rint 7. 8!date E*isting Loan1

    +rint 9. E*it +rogram1

    RE+E/T

    /cce!t ch

    Read ch

    #F:ch;31

    E)&&

    E)&

    ICP Assignment P"ge 7

  • 8/9/2019 ICP Documentation

    8/39

    ICP Assignment

    i$! "oid $iew(

    BE@#)

    #F:start node ; )8LL1

    c"rrent node ; start node

    E)&?#F

    &-H#LE :c"rrent nodes :(nti%ns< %t,e*4ise "n

    e**%* mess"ge 4i )%) %(t< teing t,e (se* t,"t ,e?s,e ,"s ente*e "n in"i in)(t

    "n m(st t*+ "g"in$

    ICP Assignment P"ge 13

  • 8/9/2019 ICP Documentation

    14/39

    ICP Assignment

    ig(*e &$1 E**%* Mess"ge 4,en "n in"i in)(t is ente*e

    I: t,e (se* 4is,es t% =e+ in " ne4 %"n< ,e?s,e m"+ )*ess 1< "n t,e inte*:"e t,en

    ,"nges "n )*%m)ts t,e (se* t% in)(t t,e :%%4ing et"is in %*e*$

    ig(*e &$& Ne4 L%"n Inte*:"e

    A:te* s(ess:(+ ente*ing " *e@(i*e in:%*m"ti%n< t,e*e 4i .e " mess"ge s,%4ing

    t,"t t,e *e%* 4"s s(ess:(+ "e$ A (se* "n t,en ,e= t,e eisting %"n .+

    *et(*ning ."= t% t,e m"in men( "n ente*ing t,e n(m.e* &< 4,i, is t% ie4 "n

    eisting %"n$

    ICP Assignment P"ge 1/

  • 8/9/2019 ICP Documentation

    15/39

    ICP Assignment

    ig(*e &$3 Eisting L%"n 4it, D(mm+ In)(t

    I: t,e (se* 4is,es t% eete "n eisting %"n< t,e+ m"+ )*ess 3< "n t,e inte*:"e 4i

    ,"nge "g"in "n )*%m)t t,e (se* t% seet t,e *e%* t% .e eete 2in t,is "se

    t,e n"me %: t,e (se* ,"s t% .e ente*e< %t,e*4ise t,e*e 4%( .e " e**%* *es)%nse

    :*%m t,e )*%g*"m5$

    Fig"re 4.7 Error when 0earching for E*isting Record

    ICP Assignment P"ge 1!

  • 8/9/2019 ICP Documentation

    16/39

    ICP Assignment

    Fig"re 4.9 2essage when a Record is s"ccessf"lly &eleted

    #f the "ser wishes to edit an e*isting record, he'she can choose o!tion 7, where the interface

    changes again, !rom!ting the "serDs name as recorded onto the database. #f the name on the

    database matches the in!"t, the delete will be s"ccessf"l. therwise, there will be an error

    ICP Assignment P"ge 19

  • 8/9/2019 ICP Documentation

    17/39

    ICP Assignment

    message.

    Fig"re 4. &eleting a Record

    Fig"re 4. Error when deleting a Record

    ICP Assignment P"ge 17

  • 8/9/2019 ICP Documentation

    18/39

    ICP Assignment

    Finally, the "ser can also !ress o!tion 9 if he'she wishes to e*it the !rogram.

    Fig"re 4.G E*iting the +rogram

    ICP Assignment P"ge 18

  • 8/9/2019 ICP Documentation

    19/39

    ICP Assignment

    ICP Assignment P"ge 1'

  • 8/9/2019 ICP Documentation

    20/39

    ICP Assignment

    Flowcharts

    "oid Main(

    ICP Assignment P"ge &0

  • 8/9/2019 ICP Documentation

    21/39

    ICP Assignment

    ICP Assignment P"ge &1

  • 8/9/2019 ICP Documentation

    22/39

    ICP Assignment

    ICP Assignment P"ge &&

  • 8/9/2019 ICP Documentation

    23/39

    ICP Assignment

    "oid dataentr#(

    ICP Assignment P"ge &3

  • 8/9/2019 ICP Documentation

    24/39

    ICP Assignment

    "oid newloan(

    ICP Assignment P"ge &/

  • 8/9/2019 ICP Documentation

    25/39

    ICP Assignment

    ICP Assignment P"ge &!

  • 8/9/2019 ICP Documentation

    26/39

    ICP Assignment

    "oid $iew(

    ICP Assignment P"ge &9

  • 8/9/2019 ICP Documentation

    27/39

    ICP Assignment

    ICP Assignment P"ge &7

  • 8/9/2019 ICP Documentation

    28/39

    ICP Assignment

    ICP Assignment P"ge &8

  • 8/9/2019 ICP Documentation

    29/39

    ICP Assignment

    "oid del(

    ICP Assignment P"ge &'

  • 8/9/2019 ICP Documentation

    30/39

    ICP Assignment

    ICP Assignment P"ge 30

  • 8/9/2019 ICP Documentation

    31/39

    ICP Assignment

    ICP Assignment P"ge 31

  • 8/9/2019 ICP Documentation

    32/39

    ICP Assignment

    "oid update(

    ICP Assignment P"ge 3&

  • 8/9/2019 ICP Documentation

    33/39

    ICP Assignment

    Source Code

    in(eBsti%$,?? st"n"* in)(t %(t)(tin(eB%ni%$,?? :%* *(nning get,25 :(nti%nin(eBsti.$,?? :%* :(nti%ns i=e st*ing ,"ning "n m"t,em"ti" %m)(t"ti%nsin(eBst*ing$,?? :%* eiting st*ing %mm"n ine

    %i"t"ent*+25st*(tmen(

    ,"*titeF&0,"*n"meF&0,"*IDF10 ,"*%eF10,"*"teF1!st*(tmen( net

    st"*t

  • 8/9/2019 ICP Documentation

    34/39

    ICP Assignment

    eit25.*e"=e:"(t#)*int:2nnt In"i ,%ie Pe"se t*+ "g"in5

    get,25

    4,ie2,J95%i"t"ent*+25 ?? "t" ent*+ ist :%* Men(

    )*int:2nt Inse*t Q%%= Tite#5gets2(**-tite5(s,2stin5)*int:2nt Inse*t Q%%= ID#5gets2(**-%e5(s,2stin5)*int:2nt Inse*t N"me#5gets2(**-n"me5(s,2stin5)*int:2nt Inse*t ID N(m.e*#5gets2(**-ID5(s,2stin5)*int:2nt Inse*t D"te O: L%"n#5gets2(**-"te5(s,2stin5

    %ine4%"n25 ?? O)ti%n 1< T% ente* " ne4 %"n

    (**Jst"*ti:2st"*tJJNULL5 ??Em)t+ istst"*tJ(**J2st*(tmen( 5m"%2sie%:2st*(tmen(55s+stem2s5"t"ent*+25(**-netJNULL)*int:2nt Re%* S(ess:(+ Ae5*et(*n??Re",ing en %: ist

    4,ie2(**-net5(**J(**-net(**-netJ2st*(tmen( 5m"%2sie%:2st*(tmen(55(**J(**-nets+stem2s5"t"ent*+25(**-netJNULL)*int:2nt E**%* in "ing Re%*5

    %iie425 ?? O)ti%n &< 6ie4 Eisting L%"n

    s+stem2s5i:2st"*tJJNULL5)*int:2nt N% Re%*s Ae Yet5(**Jst"*t4,ie2(**5

    )*int:2nnt Q%%= Tite# -&0s

  • 8/9/2019 ICP Documentation

    35/39

    ICP Assignment

    )*int:2nnt JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ5(**J(**-net

    get,25

    %ie25 ?? O)ti%n 3< Deete Eisting L%"n

    ,"*n"meF&0 ??De"*ing " ,"*"te* 2n"me5s+stem2s5)*int:2nt Seet Re%* T% Qe Deete#5gets2n"me5(**Jst"*t4,ie2(**5

    i:2st*m)2st"*t-n"me

  • 8/9/2019 ICP Documentation

    36/39

    ICP Assignment

    %ieit25

    eit205*et(*n

    ICP Assignment P"ge 39

  • 8/9/2019 ICP Documentation

    37/39

    ICP Assignment

    Conclusion

    #n concl"sion, there were many fa"lts in this !rogram and it can be f"rther im!roved tobetter s"it the woring environment and necessities of the boo loaning store. There are m"ch

    better ways to code this !rogram, as the f"nctions im!lemented in it are basic and not advanced.

    # believe that given time, this !rogram can have many "sef"l f"nctions im!lemented that can

    hel! boost clientele and wor efficiency of the boo loaning store.

    ICP Assignment P"ge 37

  • 8/9/2019 ICP Documentation

    38/39

    ICP Assignment

    'eerences

    Hanly, J. R., Koffman, E. B. and Friedman, F. L.

    Problem solving and program design in C

    In-text: :Hanly and Koffman et al., 36