Upload
tuya-dayom
View
227
Download
0
Embed Size (px)
Citation preview
7/26/2019 Database Compilation
1/40
MID-Exer1-Phonebook
Problem: Make a list of 20 people and their profile using the Form to input data in M !""ess#
1
7/26/2019 Database Compilation
2/40
MID-$2-D%&%E
Problem: ho' the relationship of ( Publishers and 1( )ooks 'ith the use of &uer* in M
!""ess#
2
7/26/2019 Database Compilation
3/40
Db+In,entor*+Duue
Problem: Pro,ide the follo'ing and their data t*pe#tb+supplier
-supno .. !%/ I-supname-sup"onta"t-supaddress
tb+"ustomer-"ustno !%/ I-"ustlast text 30-"ustfirst text 30-"ustmid text (-"ust"onta"t text (0-"ustaddress text (0-"ust"rlimit de"imal 45627-"ustrefb* integer
tb+order-ordno !%/ I-orddate-ordprodno-ordb*"ust-ordt*-ordpri"e-orddis"
tb+shipment-shipno-shipsupno ..-shipdate-shipitemno
tb+item-itemno ... !%/ I-itemsupno ..-itemt*
3
7/26/2019 Database Compilation
4/40
-itemdes"-itemunitpri"e
tb+produ"t-prodno !%/ I-proddes"
-prodt*-produpri"e-prodmaterials
"reen apture
4
7/26/2019 Database Compilation
5/40
In,entor*-8elationship-Duue
Problem: Pro,ide the follo'ingrelationship to displa* the ff:
- ustomer 49 $hole name !ddress onta"t7
- rder 49 date Produ"t o# &t* rder Pri"e7
- Produ"t 4Des"ription Prod %nit Pri"e7
pro,ide:
10 ustomers
20 Produ"ts
( orders per "ustomers
"reen atpure
5
7/26/2019 Database Compilation
6/40
MID-$1-D%&%E
Problem: %sing ;; identif* the age of the user# If age 1< and belo' a statement =>ou need
to seek a parent guidan"e= should sho' 1( to 15 a statement =>ou are a teenager= should
sho' and a statement =!re *ou sure that *ou are alread* 4!ge7= should sho' if abo,e 15 *rs
old#
6
7/26/2019 Database Compilation
7/40
ode:9in"lude ?iostream@9in"lude ?'indo's#h@using namespa"e stdA
,oid gotox* 4int x int *7B
8D "oordA "oord#C xA "oord#> *A etonsoleursorPosition4ettdandle4/D+%/P%/+!DGE7"oord7A
Hint main 47B string ame !ddressA int )irth !geA
s*stem 4="olor 1F=7A gotox* 4117A
"out ??==A gotox* 4127A
"out ?? = ame :=A gotox* 4137A "out ?? = !ddress :=A gotox* 41
7/26/2019 Database Compilation
8/40
"in @@ !ddressA gotox* 422
7/26/2019 Database Compilation
9/40
hoi"e 1
hoi"e 2
9
7/26/2019 Database Compilation
10/40
hoi"e 3
hoi"e ou famil* "an help *our "onfiden"e build=A"out ??=Qn$ith their lo,e and support *ouRll feel fulfilled#=A"out ??=QnOust donRt forget to sho' *our appre"iation=A"out ??=Qn/hat 'ill strengthen *our relation#QnQn=As*stem 4=pause=7A
H
,oid biodata47B
s*stem4="ls=7A "out ?? =)iodataQnQn=A "out ??=PE8!G IF8M!/IQn=A "out ??=ame: Oerrom abriel ! DuueQn=A "out ??=!ge: 15Qn=A "out ??=!ddress: )ankers Sillage S an Mateo 8iNalQn=A "out ??=onta"t no: 0555L(
7/26/2019 Database Compilation
18/40
"out ??=)irthda*: Mar"h 1 155Qn=A "out ??=8eligion: hirstianQn=A "out ??=FatherRs ame: auden"io Duue TrQn=A "out ??=MotherRs Maiden ame: *nthia !ndradaQnQn=A "out ??=ED%!/I!G )!8%DQn=A "out ??=Elementar*: ids $orld hristian !"adem*Qn=A
"out ??=igh "hool: 8oose,elt ollege an MateoQn=A "out ??=ollege: ala*aan ollege /e"hnologi"al Inst of the PhilQn=A
s*stem 4=pause=7A "out ??=Oerrom DuueQn=A s*stem4=pause=7AH
,oid h*mn47B s*stem4="ls=7A
"out ?? ="out *mnQnQn=A "out ??=o' as I start upon m* "hosen 'a*Qn=A "out ??=In all I do - m* thoughts m* 'ork m* pla*Qn=A "out ??=rant as i promise "ourage ne' for meQn=A "out ??=/o be the best - the best that I "an beQnQn=A
"out ??=elp me to keep m* honour shining brightQn=A "out ??=Ma* I be lo*al in the hardest fightQn=A "out ??=Get me be able for m* task and thenQn=A "out ??=/o earn a pla"e among m* fello' menQnQn=A
"out ??=pen m* e*es to see things as I shouldQn=A
"out ??=/hat I ma* do m* dail* turn of goodQn=A "out ??=Get me be read* 'aiting for ea"h needQn=A "out ??=/o keep me "lean in thought and 'ord and deedQnQn=A
"out ??=o as I Tourne* on m* "hosen 'a*Qn=A "out ??=In all I do - m* thought m* 'ork m* pla*Qn=A "out ??=good as I promise "ourage ne' for meQn=A "out ??=/o be the best - the best that I "an beQnQn=A
s*stem 4=pause=7A "out ??=Oerrom Duue ref: '''#s"reamingeagles#netQn=A s*stem4=pause=7A
H
,oid mar"h47B s*stem4="ls=7A "out ?? =/IP M!86FI/ ongQnQn=A
"out ??=$ER8E /P F /E $8GDQn=A "out ??=Musi" and G*ri"s b* Pruden"io VDeroV Pedero OrQnQn=A
18
7/26/2019 Database Compilation
19/40
"out ??=IQn=A
"out ??=Gift up *our heart and hold *our head up highQn=A
"out ??=$eWre gonna 'in 'eWre gonna fl*Qn=A "out ??=$eWre gonna rea"h our loft* dreamsQn=A
"out ??=$eW,e got the strengthA 'eW,e got the mindQnQn=A
"out ??=IIQn=A "out ??=$eW,e got the grit and the determinationQn=A "out ??=$eW,e got the "ourage and the dri,eQn=A "out ??=$e 'ill ex"eed all expe"tationsQn=A "out ??=$eWre gonna take them b* surpriseQnQn=A
"out ??=8EF8!IQn=A "out ??=$eWre on top of the 'orld /IPQn=A "out ??=$eWre the tip of the top of the 'orldXQn=A "out ??=$eWre on top of the 'orld /IPQn=A
"out ??=$eWre the tip of the top of the 'orldXQnQn=A
"out ??=)8IDEQn=A "out ??=/ogether 'e are in,in"ibleQn=A "out ??=%nited 'e are strongQn=A "out ??=$e do our ,er* bestQn=A "out ??=n top is 'here 'e belongQnQn=A
"out ??=8EPE!/ tanNa II then 8EF8!IQnQn=A
"out ??=/IP/IPXQnQn=A
s*stem 4=pause=7A "out ??=Oerrom Duue ref: '''#tip#edu#phQn=A s*stem4=pause=7AH
,oid "ustomerform147B s*stem4="ls=7A s*stem 4="olor f1=7A string "nameA string addA string "ontnumA
string bda*A string "reditA string refA string dis"A
gotox* 4117A "out ?? ==A gotox* 43327A "out ?? =D-M!G%G%I In"orporation=A
19
7/26/2019 Database Compilation
20/40
gotox* 43337A "out ?? =&ueNon it* )ran"h=A gotox* 433
7/26/2019 Database Compilation
21/40
string pbirthA string relA string ageA string "statusA string heightA string genderA
string 'eightA string paddA string telnoA string "itNnA string nfatherA string o""ufA string nmotherA string o""umA string skillA
gotox* 4117A "out ??
==A gotox* 42L27A "out ?? =E-Gegal 8e"ruiter In"#=A gotox* 4137A "out ??==A gotox* 4
7/26/2019 Database Compilation
22/40
"out ?? =/elo# :=A gotox* 4(137A "out ?? =itiNenship :=A gotox* 421(7A "out ?? =ame of Father :=A
gotox* 4(31(7A
"out ?? =""upation :=A gotox* 4217A "out ?? =ame of Mother :=A
gotox* 4(317A "out ?? =""upation :=A gotox* 431L7A "out ?? =pe"ial kills:=A
gotox* 415
7/26/2019 Database Compilation
23/40
"in @@ skillA
s*stem 4=pause=7A s*stem 4="ls=7A
s*stem 4="olor F1=7A
gotox* 4117A "out ??==A gotox* 42L27A "out ?? =E-Gegal 8e"ruiter In"#=A gotox* 4137A "out ??==A gotox* 4
7/26/2019 Database Compilation
24/40
"out ?? =""upation := ?? o""umA gotox* 431L7A "out ?? =pe"ial kills:= ?? skillA
gotox* 41157A
s*stem 4=pause=7A gotox* 41227A "out ?? =b* : OE88M !)8IEG !# D%&%E=A gotox* 412
7/26/2019 Database Compilation
25/40
"out ?? =urname:=A gotox* 40
7/26/2019 Database Compilation
26/40
"in @@ "statusA gotox* 47A "in @@ heightA gotox* 415L7A "in @@ genderA gotox* 4L7A
"in @@ 'eightA gotox* 41557A "in @@ paddA gotox* 415117A "in @@ telnoA gotox* 415137A "in @@ "itNnA gotox* 4151(7A "in @@ nfatherA gotox* 41(7A "in @@ o""ufA gotox* 41517A
"in @@ nmotherA gotox* 417A "in @@ o""umA gotox* 4151L7A "in @@ skillA
gotox* 41157A s*stem 4=pause=7A gotox* 41227A "out ?? =b* : OE88M !)8IEG !# D%&%E=A gotox* 412
7/26/2019 Database Compilation
27/40
"out ??=5# )ID!/!Qn=A66M!E#ECE"out ??=0# ECI/QnQn=A"out ??=E/E8 ! ME% EGE/I ?? @@=A
gotox*42(127A
"in @@ m"hoi"eA
if4m"hoi"e17B"ustomerform147AH
if4m"hoi"e27B"ustomerform247AHif4m"hoi"e37
Bsong47AHif4m"hoi"e
7/26/2019 Database Compilation
28/40
Problem: %sing ;; ha,e a dis"ount rate for ea"h gender 4M and F7 s*mboliNed b* 1 and 0respe"ti,el* and in relation 'ith their age# If M6F age -13 20Y age 1
7/26/2019 Database Compilation
29/40
9in"lude ?iostream@9in"lude ?'indo's#h@using namespa"e stdA
,oid gotox* 4int x int *7B
8D "oordA "oord#C xA "oord#> *A etonsoleursorPosition4ettdandle4/D+%/P%/+!DGE7"oord7AHint main 47B string ame !ddressA int ender !geA float Dis"ount8ate Dis"ount!mtA Dis"ount8ate 0A !ge0A
s*stem 4="olor 1F=7A gotox* 4117A
"out ??==A gotox* 4127A "out ?? = !ge :=A gotox* 4137A "out ?? = 41 if M and 0 if F7ender :=A
gotox* 4
7/26/2019 Database Compilation
30/40
if 4!ge @ 30 JJ ender 07 B Dis"ount8ate 0#0(A H
Dis"ount!mt Dis"ount8ate.!geA
s*stem 4="olor F1=7A gotox* 4117A
"out ??==A gotox* 4127A "out ?? = !ge :=?? !geA gotox* 4137A "out ?? = ender :=?? enderA gotox* 41
7/26/2019 Database Compilation
31/40
Problem: %sing S) "ompute for the &uiN !,erage lass tanding and rade gi,en theuiNNes attendan"e re"itation and exam of the user# In"lude the student number name and"ourse#Form 1
Form 2
odes:
%nder Form 1Pri,ate ub btn"lear+li"k47Me#txtsno#/ext ==Me#txtsname#/ext ==Me#txt"ourse#/ext ==
Me#txt1#/ext ==Me#txt2#/ext ==Me#txt3#/ext ==Me#txtatt#/ext ==Me#txtre"i#/ext ==Me#txtexam#/ext ==End ub
Pri,ate ub btnpro"essgrade+li"k47
31
7/26/2019 Database Compilation
32/40
Form2#ho'Me#ideDim ,arlasstanding !s ingleForm2#txtsno#/ext Me#txtsno#/extForm2#txtsname#/ext Me#txtsname#/extForm2#txt"ourse#/ext Me#txt"ourse#/ext
Form2#txtatt#/ext Me#txtatt#/extForm2#txtre"i#/ext Me#txtre"i#/extForm2#txtexam#/ext Me#txtexam#/extForm2#txta,e#/ext 44Sal4Me#txt1#/ext7 ; Sal4Me#txt2#/ext7 ; Sal4Me#txt3#/ext77 6 37,arlasstanding 44Sal4Form2#txta,e#/ext7 ; Sal4Me#txtatt#/ext7 ; Sal4Me#txtre"i#/ext77 6 37Form2#txtgrade#/ext 44,arlasstanding . 2 ; Sal4Me#txtexam#/ext77 6 37Form2#txt"s#/ext ,arlasstandingEnd ub
%nder Form 2Pri,ate ub btnba"k+li"k47Form1#txtsno#/ext ==
Form1#txtsname#/ext ==Form1#txt"ourse#/ext ==Form1#txt1#/ext ==Form1#txt2#/ext ==Form1#txt3#/ext ==Form1#txtatt#/ext ==Form1#txtre"i#/ext ==Form1#txtexam#/ext ==
Form1#ho'Me#ideEnd ub
Pri,ate ub btnexit+li"k47EndEnd ub
FIExer1/'oForm
32
7/26/2019 Database Compilation
33/40
Problem: reate an input form for tudent number Program enrolled and tudent ame andanother form to sho' 'hat *ou input in the pre,ious form#
Form1
Form 2
ode:%nder Form 1
33
7/26/2019 Database Compilation
34/40
Pri,ate ub ommand1+li"k47Form2#ho'Me#ide
Form2#/ext1#/ext Me#txtnum#/extForm2#/ext2#/ext Me#txtPenrolled#/ext
Form2#/ext3#/ext Me#txtname#/extEnd ub
Pri,ate ub ommand2+li"k47Me#txtnum#/ext ==Me#txtPenrolled#/ext ==Me#txtname#/ext ==End ub
Pri,ate ub /imer1+/imer47Gabel(#aption o'47End ub
%nder Form 2Pri,ate ub ommand1+li"k47Form1#ho'Me#ide
Me#/ext2#/ext ==Me#/ext1#/ext ==Me#/ext3#/ext ==End ub
FI!G+ales/ran+Duue
34
7/26/2019 Database Compilation
35/40
Problem: %sing S) "ompute for the ross ale hange !mt# and the item and its des"riptionfor D-Makabenta orporation# If the uantit* ex"eeds 100 but not o,er 200 pro,ide 2(Ydis"ount and (0Y dis"ount if more than 200#Form 1
Form 2
ode:%nder Form 1
35
7/26/2019 Database Compilation
36/40
Pri,ate ub btnlear+li"k47Me#txtname#/ext ==Me#txtItm"ode#/ext ==Me#txt&t*pur"hased#/ext ==Me#txtashonhand#/ext ==End ub
Pri,ate ub btnubmit+li"k47Form2#ho'Me#ide
Form2#txtashonhandsale#/ext Me#txtashonhand#/extForm2#txtItm"odeandDes"#/ext Me#txtItm"ode#/extForm2#txt&t*pur"hasedandPri"e#/ext Me#txt&t*pur"hased#/extForm2#txtname#/ext Me#txtname#/ext
Dim ,ukli ,%P8IE ,!GE !s ingle
Dim ,Dis" !s ingleDim ,Des" !s tring
,ukli 09,%P8IE 09,!GE 09,Des" =E888: ot Found=
If Me#txtItm"ode#/ext =123= /hen,%P8IE =2(#00=,Des" =!pples=End If
If Me#txtItm"ode#/ext =
7/26/2019 Database Compilation
37/40
Form2#txtItm"odeandDes"#/ext Form2#txtItm"odeandDes"#/ext ; =A= ; ,Des"Form2#txt&t*pur"hasedandPri"e#/ext Form2#txt&t*pur"hasedandPri"e#/ext ; =A= ;tr4,%P8IE7Form2#txthangeamt#/ext ,ukliEnd ub
Pri,ate ub /imer1+/imer47Gabel#aption o'47End ub
%nder Form 2Pri,ate ub btn)a"k+li"k47Form1#ho'Me#ide
Form1#txtashonhand ==Form1#txtname ==Form1#txtItm"ode ==
Form1#txt&t*pur"hased ==End ub
Pri,ate ub btnEnd+li"k47EndEnd ub
Pri,ate ub /imer1+/imer47Gabel#aption o'47End ub
FI!G+Parking+D%&%E
37
7/26/2019 Database Compilation
38/40
Problem: %sing S) determine the "hange amt# Parking fee and the ,ehi"le des"ription gi,enthe ,ehi"le t*pe and "ash on hand for a Parking area#
Form 1
Form2
ode:
38
7/26/2019 Database Compilation
39/40
%nder Form 1Pri,ate ub btnlear+li"k47Form1#txtash#/ext ==Form1#txtPlateno#/ext ==Form1#txtSt*pe#/ext ==End ub
Pri,ate ub btnubmit+li"k47Form2#ho'Me#ide
Dim ,hange ,Pfee !s ingleDim ,Des" !s tring
,hange 09,Pfee 09,Des" =E888: he"k Sehi"le ode=
Me#txtSt*pe#/ext %ase4Me#txtSt*pe#/ext7
If Me#txtSt*pe#/ext =!%S= /hen,Pfee =2(#00=,Des" =!sian %tilit* Sehi"le=End IfIf Me#txtSt*pe#/ext =PS/= /hen,Pfee =30#00=,Des" =Pri,ate Sehi"le=End IfIf Me#txtSt*pe#/ext =P%)= /hen,Pfee =(0#00=
,Des" =Publi" %tlit* )us=End IfIf Me#txtSt*pe#/ext =P%O= /hen,Pfee =
7/26/2019 Database Compilation
40/40
%nder Form 2Pri,ate ub btnExit+li"k47EndEnd ub
Pri,ate ub btnPro"ess+li"k47Form1#ho'Me#ide
Form1#txtash#/ext ==Form1#txtPlateno#/ext ==Form1#txtSt*pe#/ext ==End ub