MID-Exer1-Phonebook Problem: Make A List of 20 People and Their Profile Using The Form To Input Data in MS Access

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 40

MID-Exer1-Phonebook

Problem: Make a list of 20 people and their profile using the Form to input data in MS Access.

MID-SW2-DUQUE
Problem: Show the relationship of 5 Publishers and 15 Books with the use of Query in MS
Access.

Db_Inventory_Duque
Problem: Provide the following and their data type.
tb_supplier
-supno ** AUTO INC
-supname
-supcontact
-supaddress
tb_customer
-custno
AUTO INC
-custlast text 30
-custfirst text 30
-custmid text 5
-custcontact text 50
-custaddress text 50
-custcrlimit decimal (9/2)
-custrefby integer
tb_order
-ordno
AUTO INC
-orddate
-ordprodno
-ordbycust
-ordqty
-ordprice
-orddisc
tb_shipment
-shipno
-shipsupno **
-shipdate
-shipitemno
tb_item
-itemno *** AUTO INC
-itemsupno **
-itemqty
3

-itemdesc
-itemunitprice
tb_product
-prodno
AUTO INC
-proddesc
-prodqty
-produprice
-prodmaterials

Screen Capture

Inventory-Relationship-Duque
Problem: Provide the following
relationship to display the ff:
- Customer (#, Whole name, Address, Contact)
- Order (#, date, Product No., Qty, Order Price)
- Product (Description, Prod Unit Price)
provide:
10 Customers
20 Products
5 orders per customers

Screen Catpure

MID-SW1-DUQUE
Problem: Using C++, identify the age of the user. If age 14 and below, a statement "You need
to seek a parent guidance" should show, 15 to 19, a statement "You are a teenager" should
show, and a statement "Are you sure that you are already (Age)" should show if above 19 yrs
old.

Code:
#include <iostream>
#include <windows.h>
using namespace std;
void gotoxy (int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
int main ()
{
string Name, Address;
int Birth, Age;
system ("color 1F");
gotoxy (1,1);
cout <<
"====================================================================";
gotoxy (1,2);
cout << "
Name :";
gotoxy (1,3);
cout << "
Address :";
gotoxy (1,4);
cout << " Year of Birth :";
gotoxy (22,2);
cin >> Name ;
gotoxy (22,3);
7

cin >> Address;


gotoxy (22,4);
cin >> Birth;
system ("cls");
Age = 2015 - Birth;
if (Age < 13) {
gotoxy (2,6);
cout << "You need to seek a parent guidance" ;
}
if (Age > 12 && Age < 19) {
gotoxy (2,6);
cout << "You are a teenager" ;
}else{
gotoxy (2,6);
cout << "Are you sure that you are already"<< Age <<"?" ;
}
system ("color F1");
gotoxy (1,1);
cout <<
"====================================================================";
gotoxy (1,2);
cout << "
Name :"<< Name;
gotoxy (1,3);
cout << "
Address :"<< Address;
gotoxy (1,4);
cout << " Year of Birth :"<< Birth;
gotoxy (1,5);
cout << "
Age :"<< Age;
gotoxy (1,18);
system ("pause");
return 0;
}

MIDTERM-COMPILATION-DUQUE
Problem: Make a compilation of the midterm activities in C++. Provide a menu that will lead the
user to each activity.

Choice 1

Choice 2

Choice 3

Choice 4
10

Choice 5

Choice 6
11

Choice 7

Choice 8
12

Choice 9

Code:
13

#include <iostream>
#include <windows.h>
using namespace std;
void gotoxy(int cols, int rows)
{
COORD coord;
coord.Y = rows;
coord.X = cols;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
void customerform2()
{
system ("cls");
system ("color f1");
string cname;
string add;
string contnum;
string bday;
string credit;
string ref;
string disc;
gotoxy (17,1);
cout << "====================================================";
gotoxy (33,2);
cout << "D-MALULUGI, Incorporation";
gotoxy (33,3);
cout << "Quezon City Branch";
gotoxy (33,4);
cout << "Customer registration Form";
gotoxy (20,6);
cout << "Customer Name :" << cname;
gotoxy (26,7);
cout << "Address :" << add;
gotoxy (19,8);
cout << "Contact Number :" << contnum;
gotoxy (20,9);
cout << "Date of Birth :" << bday;
gotoxy (48,9);
cout << " Referred By :" << ref;
gotoxy (21,10);
cout << "Credit Limit :" << credit;
gotoxy (47,10);
cout << "Discount Rate :";
gotoxy (17,11);
cout << "====================================================";
gotoxy (18,12);
cout << "Programmed By : Duque, Jerrom Gabriel A.";
gotoxy (24,13);
cout << "Section : FMA22FB1";
14

gotoxy ( 36,6);
cin >> cname;
gotoxy (36,7);
cin >> add;
gotoxy (36,8);
cin >> contnum;
gotoxy (36,9);
cin >> bday;
gotoxy (36,10);
cin >> credit;
gotoxy (63,9);
cin >> ref;
gotoxy (63,10);
cin >> disc;
gotoxy (24,14);
system ("pause");
system ("cls");
system ("color 8F");
gotoxy (17,1);
cout << "====================================================";
gotoxy (33,2);
cout << "D-MALULUGI, Incorporation";
gotoxy (33,3);
cout << "Quezon City Branch";
gotoxy (33,4);
cout << "Customer registration Form";
gotoxy (20,6);
cout << "Customer Name :" << cname;
gotoxy (26,7);
cout << "Address :" << add;
gotoxy (19,8);
cout << "Contact Number :" << contnum;
gotoxy (20,9);
cout << "Date of Birth :" << bday;
gotoxy (48,9);
cout << " Referred By :" << ref;
gotoxy (21,10);
cout << "Credit Limit :" << credit;
gotoxy (47,10);
cout << "Discount Rate :" << disc;
gotoxy (17,11);
cout << "====================================================";
gotoxy (18,12);
cout << "Programmed By : Duque, Jerrom Gabriel A.";
gotoxy (24,13);
cout << "Section : FMA22FB1";
gotoxy (24,14);
15

system ("pause");
}
void song()
{
system ("cls");
cout << "If You See Kay\n\n";
cout << "If you see my friend, doesn't matter where or when, tell me if you see kay";
cout <<"\nIf you see my friend, doesn't matter where or when, tell me if you see kay\n\n";
cout <<"\nShe said I won the battle but I lost the war,";
cout <<"\nAnd now my head is sore,";
cout <<"\nAnd if I try and sail back in she's gonna push me from the shore,";
cout <<"\nNow I won't ever get the time or day,";
cout <<"\nNo way no way no,";
cout <<"\nNot from what I said but from what I didn't say,";
cout <<"\nWhat I didn't say\n\n";
cout <<"\nSo if you see kay will you tell her that I love her,";
cout <<"\nAnd if you see kay let her know I want her back,";
cout <<"\nIf she listens say I miss her,";
cout <<"\nEverything about her,";
cout <<"\nMake sure you say I'm sweet f.a without her,";
cout <<"\nIf you see kay\n\n";
cout <<"\nIf you see my friend, doesn't matter where or when, tell me if you see kay";
cout <<"\nIf you see my friend, doesn't matter where or when, tell me if you see kay\n\n";
cout <<"\nShe got me saying sorry through the door,";
cout <<"\nShe don't care anymore,";
cout <<"\nShe says it's to late now should have thought of this before,";
cout <<"\nBut I aint gonna take this as defeat,";
cout <<"\nNo way no way no,";
cout <<"\nCause I'm gonna shout it out to everyone I, everyone I meet\n\n";
cout <<"\nSo if you see kay will you tell her that I love her,";
cout <<"\nAnd if you see kay let her know I want her back,";
cout <<"\nIf she listens say I miss her,";
cout <<"\nEverything about her,";
cout <<"\nMake sure you say I'm sweet f.a without her,";
cout <<"\nIf you see kay\n\n";
cout <<"\nNow I'm sitting here in disbelief,";
cout <<"\nHow it truly broke my heart to have to watch her leave,";
cout <<"\nBut she was torn between what she wants and what she needs,";
cout <<"\nThey say you love someone enough you've gotta set them free,";
cout <<"\nShe said that she was born to leave this town behind,";
cout <<"\nKnew the truth but still she looked me in the eyes and lied,";
cout <<"\nSaying it's time to cut the ties,";
cout <<"\nTime to say goodbye,";
cout <<"\nSo she left,";
16

cout <<"\nBut she never never left my,";


cout <<"\nNever never left my mind\n\n";
cout <<"\nSo if you see kay will you tell her that I love her,";
cout <<"\nAnd if you see kay let her know I want her back,";
cout <<"\nIf she listens say I miss her,";
cout <<"\nEverything about her,";
cout <<"\nMake sure you say I'm sweet f.a without her,";
cout <<"\nAnd make sure you say I lost my way without her,";
cout <<"\nIf you see kay\n\n";
cout <<"\nIf you see my friend, doesn't matter where or when, tell me if you see kay";
cout << "\nIf you see my friend, doesn't matter where or when, tell me if you see kay\n\n";
system ("pause");
cout <<"\n Jerrom Duque ref: www.songtexte.com\n";
system ("pause");
}
void poem()
{
system ("cls");
cout << " Your Family\n";
cout <<"\nYour family are people, you can depend,";
cout <<"\nIf you get in trouble, they shall defend.";
cout <<"\nThey are the one's that understand,";
cout <<"\nAlways willing to give you a hand.\n\n";
cout <<"\nYour family, you should always cherish,";
cout <<"\nWithout them you would probably perish.";
cout <<"\nYour connection with them is very deep,";
cout <<"\nIf something happens, together you weep.\n\n";
cout <<"\nYou family can help, your confidence build,";
cout <<"\nWith their love and support, you'll feel fulfilled.";
cout <<"\nJust don't forget to show your appreciation,";
cout <<"\nThat will strengthen your relation.\n\n";
system ("pause");
}
void biodata()
{
system("cls");
cout << "Biodata\n\n";
cout <<"PERSONAL INFROMATION\n";
cout <<"Name: Jerrom Gabriel A Duque\n";
cout <<"Age: 19\n";
cout <<"Address: Bankers Village V, San Mateo, Rizal\n";
cout <<"Contact no: 09998546381\n";
cout <<"Email: morrejgabriel@gmail.com\n";
cout <<"Gender: M\n";
17

cout <<"Birthday: March 16, 1996\n";


cout <<"Religion: Chirstian\n";
cout <<"Father's Name: Gaudencio G Duque jr\n";
cout <<"Mother's Maiden Name: Cynthia C Andrada\n\n";
cout <<"EDUCATIONAL BACKGROUND\n";
cout <<"Elementary: Kids World Christian Academy\n";
cout <<"High School: Roosevelt College San Mateo\n";
cout <<"College: Kalayaan College, Technological Inst of the Phil\n";
system ("pause");
cout <<"Jerrom Duque\n";
system("pause");
}
void hymn()
{
system("cls");
cout << "Scout Hymn\n\n";
cout <<"Now as I start upon my chosen way\n";
cout <<"In all I do - my thoughts, my work, my play\n";
cout <<"Grant as i promise, courage new for me\n";
cout <<"To be the best - the best that I can be\n\n";
cout <<"Help me to keep my honour shining bright\n";
cout <<"May I be loyal in the hardest fight\n";
cout <<"Let me be able, for my task and then\n";
cout <<"To earn a place, among my fellow men\n\n";
cout <<"Open my eyes to see things as I should\n";
cout <<"That I may do my daily turn of good\n";
cout <<"Let me be ready, waiting for each need\n";
cout <<"To keep me clean, in thought and word and deed\n\n";
cout <<"So as I journey, on my chosen way\n";
cout <<"In all I do - my thought, my work, my play\n";
cout <<"good as I promise, courage new for me\n";
cout <<"To be the best - the best that I can be\n\n";
system ("pause");
cout <<"Jerrom Duque ref: www.screamingeagles.net\n";
system("pause");
}
void march()
{
system("cls");
cout << "TIP MARCH/FIGHT Song\n\n";
cout <<"WE'RE ON TOP OF THE WORLD\n";
cout <<"Music and Lyrics by Prudencio Dero Pedero Jr\n\n";
18

cout <<"I\n";
cout <<"Lift up your heart, and hold your head up high\n";
cout <<"Were gonna win, were gonna fly\n";
cout <<"Were gonna reach our lofty dreams\n";
cout <<"Weve got the strength; weve got the mind\n\n";
cout <<"II\n";
cout <<"Weve got the grit and the determination\n";
cout <<"Weve got the courage and the drive\n";
cout <<"We will exceed all expectations\n";
cout <<"Were gonna take them by surprise\n\n";
cout <<"REFRAIN\n";
cout <<"Were on top of the world TIP,\n";
cout <<"Were the tip of the top of the world!\n";
cout <<"Were on top of the world TIP,\n";
cout <<"Were the tip of the top of the world!\n\n";
cout <<"BRIDGE\n";
cout <<"Together we are invincible,\n";
cout <<"United we are strong,\n";
cout <<"We do our very best,\n";
cout <<"On top is where we belong\n\n";
cout <<"REPEAT Stanza II then REFRAIN\n\n";
cout <<"TIP,TIP!\n\n";
system ("pause");
cout <<"Jerrom Duque ref: www.tip.edu.ph\n";
system("pause");
}
void customerform1()
{
system("cls");
system ("color f1");
string cname;
string add;
string contnum;
string bday;
string credit;
string ref;
string disc;
gotoxy (17,1);
cout << "====================================================";
gotoxy (33,2);
cout << "D-MALULUGI, Incorporation";
19

gotoxy (33,3);
cout << "Quezon City Branch";
gotoxy (33,4);
cout << "Customer registration Form";
gotoxy (20,6);
cout << "Customer Name :" << cname;
gotoxy (26,7);
cout << "Address :" << add;
gotoxy (19,8);
cout << "Contact Number :" << contnum;
gotoxy (20,9);
cout << "Date of Birth :" << bday;
gotoxy (48,9);
cout << " Referred By :" << ref;
gotoxy (21,10);
cout << "Credit Limit :" << credit;
gotoxy (47,10);
cout << "Discount Rate :";
gotoxy (17,11);
cout << "====================================================";
gotoxy (18,12);
cout << "Programmed By : Duque, Jerrom Gabriel A.";
gotoxy (24,13);
cout << "Section : FMA22FB1";
gotoxy ( 36,6);
cin >> cname;
gotoxy (36,7);
cin >> add;
gotoxy (36,8);
cin >> contnum;
gotoxy (36,9);
cin >> bday;
gotoxy (36,10);
cin >> credit;
gotoxy (63,9);
cin >> ref;
gotoxy (63,10);
cin >> disc;
gotoxy (24,14);
system ("pause");
}
void bioform2()
{
system("cls");
system ("color 8F");
string gname;
string sname;
string mname;
string dbirth;
20

string pbirth;
string rel;
string age;
string cstatus;
string height;
string gender;
string weight;
string padd;
string telno;
string citzn;
string nfather;
string occuf;
string nmother;
string occum;
string skill;
gotoxy (1,1);
cout <<
"========================================================================
=======";
gotoxy (28,2);
cout << "E-Legal Recruiter Inc.";
gotoxy (1,3);
cout <<
"========================================================================
=======";
gotoxy (6,4);
cout << "Given Name :";
gotoxy (32,4);
cout << "Surname:";
gotoxy (60,4);
cout << "M.I.:";
gotoxy (3,5);
cout << "Date of Birth :";
gotoxy (49,5);
cout << "Place of Birth :";
gotoxy (8,6);
cout << "Religion :";
gotoxy (60,6);
cout << "Age :";
gotoxy (4,7);
cout << "Civil Status :";
gotoxy (57,7);
cout << "Height :";
gotoxy (10,8);
cout << "Gender :";
gotoxy (57,8);
cout << "Weight :";
gotoxy (1,9);
cout << "Present Address :";
gotoxy (10,11);
21

cout << "TelNo. :";


gotoxy (5,13);
cout << "Citizenship :";
gotoxy (2,15);
cout << "Name of Father :";
gotoxy (53,15);
cout << "Occupation :";
gotoxy (2,16);
cout << "Name of Mother :";
gotoxy (53,16);
cout << "Occupation :";
gotoxy (3,18);
cout << "Special Skills:";
gotoxy (19,4);
cin >> gname;
gotoxy (41,4);
cin >> sname;
gotoxy (66,4);
cin >> mname;
gotoxy (19,5);
cin >> dbirth;
gotoxy (66,5);
cin >> pbirth;
gotoxy (19,6);
cin >> rel;
gotoxy (66,6);
cin >> age;
gotoxy (19,7);
cin >> cstatus;
gotoxy (66,7);
cin >> height;
gotoxy (19,8);
cin >> gender;
gotoxy (66,8);
cin >> weight;
gotoxy (19,9);
cin >> padd;
gotoxy (19,11);
cin >> telno;
gotoxy (19,13);
cin >> citzn;
gotoxy (19,15);
cin >> nfather;
gotoxy (66,15);
cin >> occuf;
gotoxy (19,16);
cin >> nmother;
gotoxy (66,16);
cin >> occum;
gotoxy (19,18);
22

cin >> skill;


system ("pause");
system ("cls");
system ("color F1");
gotoxy (1,1);
cout <<
"========================================================================
=======";
gotoxy (28,2);
cout << "E-Legal Recruiter Inc.";
gotoxy (1,3);
cout <<
"========================================================================
=======";
gotoxy (6,4);
cout << "Given Name :" << gname;
gotoxy (32,4);
cout << "Surname:"<< sname;
gotoxy (60,4);
cout << "M.I.:" << mname;
gotoxy (3,5);
cout << "Date of Birth :" << dbirth;
gotoxy (49,5);
cout << "Place of Birth :" << pbirth;
gotoxy (8,6);
cout << "Religion :" << rel;
gotoxy (60,6);
cout << "Age :" << age;
gotoxy (4,7);
cout << "Civil Status :" << cstatus;
gotoxy (57,7);
cout << "Height :" << height;
gotoxy (10,8);
cout << "Gender :" << gender;
gotoxy (57,8);
cout << "Weight :" << weight;
gotoxy (1,9);
cout << "Present Address :" <<padd;
gotoxy (10,11);
cout << "TelNo. :" << telno;
gotoxy (5,13);
cout << "Citizenship :" << citzn;
gotoxy (2,15);
cout << "Name of Father :" << nfather;
gotoxy (53,15);
cout << "Occupation :" << occuf;
gotoxy (2,16);
cout << "Name of Mother :" << nmother;
gotoxy (53,16);
23

cout << "Occupation :" << occum;


gotoxy (3,18);
cout << "Special Skills:" << skill;
gotoxy (1,19);
system ("pause");
gotoxy (16,22);
cout << "by : JERROM GABRIEL A. DUQUE";
gotoxy (1,24);
system ("pause");
}
void bioform1()
{
system("cls");
system ("color 8F");
string gname;
string sname;
string mname;
string dbirth;
string pbirth;
string rel;
string age;
string cstatus;
string height;
string gender;
string weight;
string padd;
string telno;
string citzn;
string nfather;
string occuf;
string nmother;
string occum;
string skill;
gotoxy (1,1);
cout <<
"========================================================================
=======";
gotoxy (28,2);
cout << "E-Legal Recruiter Inc.";
gotoxy (1,3);
cout <<
"========================================================================
=======";
gotoxy (6,4);
cout << "Given Name :";
gotoxy (32,4);
24

cout << "Surname:";


gotoxy (60,4);
cout << "M.I.:";
gotoxy (3,5);
cout << "Date of Birth :";
gotoxy (49,5);
cout << "Place of Birth :";
gotoxy (8,6);
cout << "Religion :";
gotoxy (60,6);
cout << "Age :";
gotoxy (4,7);
cout << "Civil Status :";
gotoxy (57,7);
cout << "Height :";
gotoxy (10,8);
cout << "Gender :";
gotoxy (57,8);
cout << "Weight :";
gotoxy (1,9);
cout << "Present Address :";
gotoxy (10,11);
cout << "TelNo. :";
gotoxy (5,13);
cout << "Citizenship :";
gotoxy (2,15);
cout << "Name of Father :";
gotoxy (53,15);
cout << "Occupation :";
gotoxy (2,16);
cout << "Name of Mother :";
gotoxy (53,16);
cout << "Occupation :";
gotoxy (3,18);
cout << "Special Skills:";
gotoxy (19,4);
cin >> gname;
gotoxy (41,4);
cin >> sname;
gotoxy (66,4);
cin >> mname;
gotoxy (19,5);
cin >> dbirth;
gotoxy (66,5);
cin >> pbirth;
gotoxy (19,6);
cin >> rel;
gotoxy (66,6);
cin >> age;
gotoxy (19,7);
25

cin >> cstatus;


gotoxy (66,7);
cin >> height;
gotoxy (19,8);
cin >> gender;
gotoxy (66,8);
cin >> weight;
gotoxy (19,9);
cin >> padd;
gotoxy (19,11);
cin >> telno;
gotoxy (19,13);
cin >> citzn;
gotoxy (19,15);
cin >> nfather;
gotoxy (66,15);
cin >> occuf;
gotoxy (19,16);
cin >> nmother;
gotoxy (66,16);
cin >> occum;
gotoxy (19,18);
cin >> skill;
gotoxy (1,19);
system ("pause");
gotoxy (16,22);
cout << "by : JERROM GABRIEL A. DUQUE";
gotoxy (1,24);
system ("pause");
}
int main()
{
int mchoice;
while (mchoice!=0)
{
mchoice=99;
system("cls");
system("color f0");
cout <<"PRELIM COMPILATION\n";
cout <<"1. CUSTOMER FORM 2\n";
cout <<"2. CUSTOMER FORM 1\n";
cout <<"3. SONG\n";
cout <<"4. POEM\n";
cout <<"5. HYMN\n";
cout <<"6. MARCH\n";
cout <<"7. BIOFORM 1\n";
cout <<"8. BIOFORM 2\n";
26

cout <<"9. BIODATA\n";


//MSACCESS.EXE
cout <<"0. EXIT\n\n";
cout <<"ENTER A MENU SELECTION << >>";
gotoxy(25,12);
cin >> mchoice;
if(mchoice==1)
{
customerform1();
}
if(mchoice==2)
{
customerform2();
}
if(mchoice==3)
{
song();
}
if(mchoice==4)
{
poem();
}
if(mchoice==5)
{
hymn();
}
if(mchoice==6)
{
march();
}
if(mchoice==7)
{
bioform1();
}
if(mchoice==8)
{
bioform2();
}
if(mchoice==9)
{
biodata();
}
}
system("pause");
return 0;}
Sample_IFConditions

27

Problem: Using C++, have a discount rate for each gender (M and F) symbolized by 1 and 0
respectively, and in relation with their age. If M/F age 7-13 20%, age 14-18 15%, and 19-22 5%.
If female age 23-30 5%, and more than 30 will get 5%. Find the Discount amount = Disc. Rate*
Age.
Output 1

Output 2

Code:

28

#include <iostream>
#include <windows.h>
using namespace std;
void gotoxy (int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),coord);
}
int main ()
{
string Name, Address;
int Gender, Age;
float DiscountRate, DiscountAmt;
DiscountRate= 0;
Age=0;

system ("color 1F");


gotoxy (1,1);
cout <<
"====================================================================";
gotoxy (1,2);
cout << "
Age :";
gotoxy (1,3);
cout << " (1 if M and 0 if F)Gender :";
gotoxy (40,2);
cin >> Age;
gotoxy (40,3);
cin >> Gender;
system ("cls");
if (Age > 6 && Age < 14 && (Gender == 1 || Gender == 0)) {
DiscountRate = 0.20 ;
}
if (Age > 13 && Age < 19 && (Gender == 1 || Gender == 0)) {
DiscountRate = 0.15 ;
}
if (Age > 18 && Age < 23 && (Gender == 1 || Gender == 0)) {
DiscountRate = 0.05;
}
if (Age > 22 && Age < 31 && Gender == 0) {
DiscountRate = 0.05;
}
29

if (Age > 30 && Gender == 0) {


DiscountRate = 0.05;
}
DiscountAmt= DiscountRate*Age;
system ("color F1");
gotoxy (1,1);
cout <<
"====================================================================";
gotoxy (1,2);
cout << "
Age :"<< Age;
gotoxy (1,3);
cout << "
Gender :"<< Gender;
gotoxy (1,4);
cout << " Discount Rate :"<< DiscountRate;
gotoxy (1,5);
cout << " Discount Amount :"<< DiscountAmt;

gotoxy (1,18);
system ("pause");
return 0;
}

FINGrades-Duque
30

Problem: Using VB, compute for the Quiz Average, Class Standing, and Grade given the
quizzes, attendance, recitation, and exam of the user. Include the student number, name, and
course.
Form 1

Form 2

Codes:
Under Form 1
Private Sub btnclear_Click()
Me.txtsno.Text = ""
Me.txtsname.Text = ""
Me.txtcourse.Text = ""
Me.txtq1.Text = ""
Me.txtq2.Text = ""
Me.txtq3.Text = ""
Me.txtatt.Text = ""
Me.txtreci.Text = ""
Me.txtexam.Text = ""
End Sub
Private Sub btnprocessgrade_Click()
31

Form2.Show
Me.Hide
Dim varClassStanding As Single
Form2.txtsno.Text = Me.txtsno.Text
Form2.txtsname.Text = Me.txtsname.Text
Form2.txtcourse.Text = Me.txtcourse.Text
Form2.txtatt.Text = Me.txtatt.Text
Form2.txtreci.Text = Me.txtreci.Text
Form2.txtexam.Text = Me.txtexam.Text
Form2.txtqave.Text = ((Val(Me.txtq1.Text) + Val(Me.txtq2.Text) + Val(Me.txtq3.Text)) / 3)
varClassStanding = ((Val(Form2.txtqave.Text) + Val(Me.txtatt.Text) + Val(Me.txtreci.Text)) / 3)
Form2.txtgrade.Text = ((varClassStanding * 2 + Val(Me.txtexam.Text)) / 3)
Form2.txtcs.Text = varClassStanding
End Sub
Under Form 2
Private Sub btnback_Click()
Form1.txtsno.Text = ""
Form1.txtsname.Text = ""
Form1.txtcourse.Text = ""
Form1.txtq1.Text = ""
Form1.txtq2.Text = ""
Form1.txtq3.Text = ""
Form1.txtatt.Text = ""
Form1.txtreci.Text = ""
Form1.txtexam.Text = ""
Form1.Show
Me.Hide
End Sub
Private Sub btnexit_Click()
End
End Sub

FINExer1TwoForm
32

Problem: Create an input form for Student number, Program enrolled, and Student Name and
another form to show what you input in the previous form.
Form1

Form 2

Code:
Under Form 1
33

Private Sub Command1_Click()


Form2.Show
Me.Hide
Form2.Text1.Text = Me.txtSnum.Text
Form2.Text2.Text = Me.txtPenrolled.Text
Form2.Text3.Text = Me.txtSname.Text
End Sub
Private Sub Command2_Click()
Me.txtSnum.Text = ""
Me.txtPenrolled.Text = ""
Me.txtSname.Text = ""
End Sub
Private Sub Timer1_Timer()
Label5.Caption = Now()
End Sub
Under Form 2
Private Sub Command1_Click()
Form1.Show
Me.Hide
Me.Text2.Text = ""
Me.Text1.Text = ""
Me.Text3.Text = ""
End Sub

FINALS_SalesTran_Duque
34

Problem: Using VB, compute for the Gross Sale, Change Amt., and the item and its description
for D-Makabenta Corporation. If the quantity exceeds 100 but not over 200, provide 25%
discount and, 50% discount if more than 200.
Form 1

Form 2

Code:
Under Form 1
35

Private Sub btnClear_Click()


Me.txtCname.Text = ""
Me.txtItmcode.Text = ""
Me.txtQtypurchased.Text = ""
Me.txtCashonhand.Text = ""
End Sub
Private Sub btnSubmit_Click()
Form2.Show
Me.Hide
Form2.txtCashonhandGsale.Text = Me.txtCashonhand.Text
Form2.txtItmcodeandDesc.Text = Me.txtItmcode.Text
Form2.txtQtypurchasedandPrice.Text = Me.txtQtypurchased.Text
Form2.txtCname.Text = Me.txtCname.Text
Dim vSukli, vUPRICE, vGSALE As Single
Dim vDisc As Single
Dim vDesc As String
vSukli = 0#
vUPRICE = 0#
vGSALE = 0#
vDesc = "ERROR: Not Found"
If Me.txtItmcode.Text = "123" Then
vUPRICE = "25.00"
vDesc = "Apples"
End If
If Me.txtItmcode.Text = "456" Then
vUPRICE = "35.00"
vDesc = "Grapes"
End If
If Me.txtItmcode.Text = "789" Then
vUPRICE = "45.00"
vDesc = "Oranges"
End If
If Val(Me.txtQtypurchased.Text) > 99 And Val(Me.txtQtypurchased.Text) < 201 Then
vDisc = 0.2
End If
If Val(Me.txtQtypurchased.Text) > 200 Then
vDisc = 0.5
End If
vGSALE = (Me.txtQtypurchased.Text * vUPRICE) - (Me.txtQtypurchased.Text * vUPRICE *
vDisc)
vSukli = Me.txtCashonhand - vGSALE
Form2.txtCashonhandGsale.Text = Form2.txtCashonhandGsale.Text + ";" + Str(vGSALE)
36

Form2.txtItmcodeandDesc.Text = Form2.txtItmcodeandDesc.Text + ";" + vDesc


Form2.txtQtypurchasedandPrice.Text = Form2.txtQtypurchasedandPrice.Text + ";" +
Str(vUPRICE)
Form2.txtChangeamt.Text = vSukli
End Sub
Private Sub Timer1_Timer()
Label7.Caption = Now()
End Sub
Under Form 2
Private Sub btnBack_Click()
Form1.Show
Me.Hide
Form1.txtCashonhand = ""
Form1.txtCname = ""
Form1.txtItmcode = ""
Form1.txtQtypurchased = ""
End Sub
Private Sub btnEnd_Click()
End
End Sub
Private Sub Timer1_Timer()
Label7.Caption = Now()
End Sub

FINALS_Parking_DUQUE
37

Problem: Using VB, determine the change amt., Parking fee and the vehicle description given
the vehicle type and cash on hand for a Parking area.
Form 1

Form2

Code:
38

Under Form 1
Private Sub btnClear_Click()
Form1.txtCash.Text = ""
Form1.txtPlateno.Text = ""
Form1.txtVtype.Text = ""
End Sub
Private Sub btnSubmit_Click()
Form2.Show
Me.Hide
Dim vChange, vPfee As Single
Dim vDesc As String
vChange = 0#
vPfee = 0#
vDesc = "ERROR: Check Vehicle Code"
Me.txtVtype.Text = UCase(Me.txtVtype.Text)
If Me.txtVtype.Text = "AUV" Then
vPfee = "25.00"
vDesc = "Asian Utility Vehicle"
End If
If Me.txtVtype.Text = "PVT" Then
vPfee = "30.00"
vDesc = "Private Vehicle"
End If
If Me.txtVtype.Text = "PUB" Then
vPfee = "50.00"
vDesc = "Public Utlity Bus"
End If
If Me.txtVtype.Text = "PUJ" Then
vPfee = "40.00"
vDesc = "Public Utility Jeepney"
End If
If Me.txtVtype.Text = "MTR" Then
vPfee = "20.00"
vDesc = "Motorcycle"
End If
vChange = Val(Me.txtCash.Text) - vPfee
Form2.txtVtypeandDesc.Text = Me.txtVtype.Text
Form2.txtVdesc.Text = vDesc
Form2.txtPfee.Text = vPfee
Form2.txtChangeamt.Text = vChange
End Sub
39

Under Form 2
Private Sub btnExit_Click()
End
End Sub
Private Sub btnProcess_Click()
Form1.Show
Me.Hide
Form1.txtCash.Text = ""
Form1.txtPlateno.Text = ""
Form1.txtVtype.Text = ""
End Sub

40

You might also like