meljun cortes itc 32
TRANSCRIPT
-
7/27/2019 MELJUN CORTES ITC 32
1/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
FIRST PRELIMINARY PERIOD
GRADED EXERCISE #1:
Create a JavaScript code that will show the output below. It presents JavaScript features and eventsas previously discussed. If no input was made, default value for name will be Jose Rizal; course willbe BSIT (for ITC 32) and BCS-CS (for CSC 44) and 0 for no. of units. For Computer courses,course rate is PhP 350.00 otherwise course rate is PhP 300.00.
Sample Output:
Page 1 of 26
-
7/27/2019 MELJUN CORTES ITC 32
2/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
OUTPUT:
Page 2 of 26
-
7/27/2019 MELJUN CORTES ITC 32
3/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #2:
Create a JavaScript code that will show the output below. It accepts input of two (2) numeric values,and a guessed value of the sum. The output displays the correct value of the sum.
Page 3 of 26
-
7/27/2019 MELJUN CORTES ITC 32
4/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
Page 4 of 26
-
7/27/2019 MELJUN CORTES ITC 32
5/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
Page 5 of 26
-
7/27/2019 MELJUN CORTES ITC 32
6/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
MIDTERM PERIOD
GRADED EXERCISE #3:
MYSQL DatabasesCreate a MySQL database named using the following name format: db_Handyman. Use the ff. tables, fields and records below adatabase content.
Page 6 of 26
-
7/27/2019 MELJUN CORTES ITC 32
7/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
Page 7 of 26
HANDYMAN HARDWARE STORE
SALES_REP
SLSREP_NO LAST FIRST STREET CITY STATE ZIP_CODE TOTAL_COMM COMM_RATE
03 Jones Mary 123 Main Grant MI 49219 2,150.00 0.05
06 Smith William 102 Raymond Ada MI 49441 4,912.50 0.07
12 Diaz Miguel 419 Harper Lansing MI 49224 2,150.00 0.05
CUSTOMER
CUST_NO LAST FIRST STREET CITY STATE ZIP_CODE BALANCE CREDIT_LIMIT SLSREP_
124 Adams Sally 481 Oak Lansing MI 49224 818.75 1,000 03
256 Samuels Ann 215 Pete Grant MI 49219 21.50 1,500 06
311 Charles Don 48 College Ira MI 49034 825.75 1,000 12
315 Daniels Tom 914 Cherry Kent MI 48391 770.75 750 06
405 Williams Al 519 Watson Grant MI 49219 402.75 1,500 12
412 Adams Sally 16 Elm Lansing MI 49224 1,817.50 2,000 03
522 Nelson Mary 108 Pine Ada MI 49441 98.75 1,500 12
567 Dinh Tran 808 Ridge Harper MI 48421 402.40 750 06
587 Galvez Mara 512 Pine Ada MI 49441 114.60 1,000 06
622 Martin Dan 419 Chip Grant MI 49219 1,045.75 1,000 03
ORDERS ORDER_LINE
ORDER_NO ORDER_DATE CUST_NO ORDER_NO PART_NO QTY_ORDER QUOTED_PRICE
12489 9/2/2002 124 12489 AX12 11 21.95
12491 9/2/2002 311 12491 BT04 1 149.9912494 9/4/2002 315 12491 BZ66 1 399.99
12495 9/4/2002 256 12494 CB03 4 279.99
12498 9/5/2002 522 12495 CX11 2 22.95
12500 9/5/2002 124 12498 AZ52 2 12.95
12504 9/5/2002 522 12498 BA74 4 24.95
12500 BT04 1 149.99
12504 CZ81 2 325.99
PART
PART_NO PART_DESC UNITS_ON_HAND ITEM_CLASS WAREHOUSE_NO UNIT_PRICE
AX12 Iron 104 HW 3 24.95
AZ52 Dartboard 20 SG 2 12.95
BA74 Basketball 40 SG 1 29.95
BH22 Cornpopper 95 HW 3 24.95
BT04 Gas Grill 11 AP 2 149.99
BZ66 Washer 52 AP 3 399.99
-
7/27/2019 MELJUN CORTES ITC 32
8/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
Perform the instructions indicated below using MySQL. Write on a one whole sheet of yellow paperthe MySQL commands used in executing the instructions or the answer to the questions indicated.
1. Open MySQL. What login name did you use in logging on to MySQL Server?2. What password was used in logging on?3. Create a database named using the following name format: db_csc44c1_23 for CS db_it32c1_23
for IT and where 23 is your permanent number .4. Use the newly created database.5. What is the name of the newly created database?
For the succeeding numbers, refer to the Handyman Hardware Store of the handout.
6. Create the Sales_rep table.7. Create the Customer table.
8. Create the Orders table.9. Create the Part table.10. Create the Order_line table.
11. Add the records for the Sales_rep table. (Write the SQL command for the first record only.)12. Add the records for the Customer table. (Write the SQL command for the first record only.)13. Add the records for the Orders table. (Write the SQL command for the first record only.)14. Add the records for the Part table. (Write the SQL command for the first record only.)15. Add the records for the Order_line table. (Write the SQL command for the first record only.)
16. Display all the records in the Sales_rep table.17. Display all the records in the Customer table.18. Display all the records in the Orders table.19. Display all the records in the Part table.20. Display all the records in the Order_line table.
21. Count the records in the Sales_rep table.22. How many records are there in the Sales_rep table?
23. Count the records in the Customer table.24. How many records are there in the Customer table?
25. Count the records in the Orders table.26. How many records are there in the Orders table?
27. Count the records in the Part table.28. How many records are there in the Part table?
29. Count the records in the Order_line table.30. How many records are there in the Order_line table?
Page 8 of 26
-
7/27/2019 MELJUN CORTES ITC 32
9/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #4:
MYSQL DatabasesCreate a MySQL database named using the following name format: db_Bookstore. Use the ff.
tables, fields and records below as database content.
Page 9 of 26
-
7/27/2019 MELJUN CORTES ITC 32
10/26
-
7/27/2019 MELJUN CORTES ITC 32
11/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
Based on the tables above, create a table structure for the National Bookstore and input the data
NATIONAL BOOKSTORE INC.
TableFIELDNAME Type Length Decimal Place Allow Nulls Primary Key Description
BRANCH
No Branch Number
Branch Name
Branch Location
Number of Employees
PUBLISHER
No Publisher Code
Publisher Name
Publisher City
Publisher State
AUTHOR
No Author Number
Author Last Name
Author First Name
BOOK
No Book Code
Book Title
Publisher Code
Book Type
Book Price
Paperback (Y or N)
WRITTEN
No Book Code
No Author Number
Sequence Number
INVENTORY
No Book Code
No Branch Number
Units on hand
GRADED EXERCISE #4:
MYSQL Databases
1. Create a database named studentsDB2. Create a table named studentsTB3. Table Structure:
Field Type Null Key Default Extra
id int(5) No Pri Null auto_increment
name varchar(15) No Nullsex char(1) No Null
birthdate date No Null
address varchar(15) No Null
contactno varchar(10) Yes Null
course varchar(10) No Null
yearlevel char(1) No Nulll
Page 11 of 26
-
7/27/2019 MELJUN CORTES ITC 32
12/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
4. Insert the following records:
QUERIES:
1) Display all 4th year students only;2) Display all BSIT and BSCS students only;3) Edit Arlenes address from Mandaluyong Cit to Mandaluyong and display only Arlenes record.4) Display all male students from Quezon City only5) Display the name, course, year level and name must be in alphabetic order.6) Add and display the record below:
NAME SEX BIRTHDATE ADDRESS CONTACTNO COURSE YEARLEVELLester M 1960-11-01 San Juan Null BSCS 4
7) Display name & birthdate born in 1975 onwards. Date of birth must be displayed from the youngestto oldest
8) Display the name & address with no contact number;
9) Display the name, birthdate and age from oldest to youngest.10) Display the name & birthdate whose month birthday is November
Complete Records:
id name Sex birthdate address contactno Course Yearlevel
1 Richard M 1973-10-07 Quezon City 422-5267 BSMath 4
2 Dorie F 1975-09-10 Batangas 913-6791 BSN 1
3 Darrel M 1980-11-21 Quezon City 422-5267 BSIT 2
4 Railynne F 1982-11-28 Quezon City Null BSN 1
5 Ruskin M 1980-08-10 Mandaluyong 531-7209 BSCS 3
6 Noli M 1970-09-06 Pasig City Null BSCpE 4
7 Arlene F 1965-11-08 Mandaluyong Cit 0917-8051962 BSCS 4
8 Lester M 1960-11-01 San Juan Null BSCS 4
Page 12 of 26
-
7/27/2019 MELJUN CORTES ITC 32
13/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
REQUIRED OUTPUT:
1) Display all 4th year students only;
2) Display all BSIT and BSCS students only;
3) Edit Arlenes address from Mandaluyong Cit to Mandaluyong and display only Arlenes record.
4) Display all male students from Quezon City only
5) Display the name, course, year level and name must be in alphabetic order.
6) Add and display the record below:NAME SEX BIRTHDATE ADDRESS CONTACTNO COURSE YEARLEVELLester M 1960-11-01 San Juan Null BSCS 4
Page 13 of 26
-
7/27/2019 MELJUN CORTES ITC 32
14/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
7) Display name & birthdate born in 1975 onwards. Date of birth must be displayed from the youngestto oldest
8) Display the name & address with no contact number;
9) Display the name, birthdate and age from oldest to youngest. (Please disregard column age outputjust follow the question)
Display the name
Page 14 of 26
-
7/27/2019 MELJUN CORTES ITC 32
15/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #5:
MYSQL Databases
1. Add a new table to your database (studentsDB)2. Create a table named studInfoTB (see Table Structure below)3. Type the records as shown in the table below (Note: Use Notepad and save it to local drive (C:\))4. Use LOAD DATA LOCAL INFILE command to insert all records.5. Copy and paste your final answer from mysql prompt to OpenOffice.Org WRITERand save it with
password(no password means zero (0))
Table Structure:
Complete Table:
Display records based on the given output:
Page 15 of 26
1)
2)
3)
4)
5)
Note: Output must be the same as the table shown above
-
7/27/2019 MELJUN CORTES ITC 32
16/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #6:
Write a PHP code that will display the following:a. Complete date and time today.
b. Your complete name in all capital letters (using strtoupper() function); and do the FF.: Display the Area, Circumference, and Diameter of a circle if the radius is 23.
Display the Area of a triangle if the base is 10 and the height is 12.
Display the value in degrees Celsius if the degree in Fahrenheit is 50.
Display the value of 1500 pesos in dollars if the conversion factor is $1 = P54.25
Use the following:
1. Celsius = 5/9 * (Fahrenheit 32)2. Diameter = 2 * Radius3. Circumference = 2 * Pi * Radius4. Area (circle)= Pi * Radius * Radius
5. Area (triangle) = * Base * Height
Refer to the output below:
Page 16 of 26
-
7/27/2019 MELJUN CORTES ITC 32
17/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
PRACTICE EXERCISE #1:
Input Tags (Text, Submit, Reset)
***** Codes starts
here:
DATA ENTRY
Enter your name:
Enter your age:
Enter your phone no.:Enter your bill:
End *****
+++++0+++++0+++++0+++++
Page 17 of 26
***** Codes starts here:
End *****
Sample output:
-
7/27/2019 MELJUN CORTES ITC 32
18/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
PRACTICE EXERCISE #2:
Input Validation (ctype_alpha( ), ctype_digit( ), empty( ), is_string( ), and is_numeric( ) functions)
***** Codes starts here:
DATA ENTRY
Enter your name:
Enter your age:
Enter your phone no.:
Enter your bill:
End *****
+++++0+++++0+++++0+++++
***** Codes starts here:
-
7/27/2019 MELJUN CORTES ITC 32
19/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
$bill = $_POST['txtBill'];elseif(!is_numeric($_POST['txtBill']))
$bill = "letters and special characters are not allowed";
echo "OUTPUT WITH INPUT VALIDATION
";echo "Name: $name
";echo "Age: $age
";echo "Phone: $phone
";echo "Bill: $bill
";?>
End *****
Sample Output: Output with invalid input and empty value:
Page 19 of 26
-
7/27/2019 MELJUN CORTES ITC 32
20/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
Sample Output: Output with invalid input for name only (space is notallowed)
Sample Output:Output with valid inputs
Page 20 of 26
-
7/27/2019 MELJUN CORTES ITC 32
21/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #7:
ValidationCreate guest information that would ask the user to input the following data and display the output basedbelow:
SAMPLE OUTPUT:
Page 21 of 26
-
7/27/2019 MELJUN CORTES ITC 32
22/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #8:
Create an On-line Shopping store as shown below. For cash payment, a 10% discount will bededucted from the total amount otherwise a 10% charge will be added.
Page 22 of 26
-
7/27/2019 MELJUN CORTES ITC 32
23/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #9:1. Create a PHP program that will generate the output below. Consider the ff:
Salary Allowance = Salary / 5
Age Allowance = (Age/10 (Age % 10) / 10 ) 1
Loan Allowance = Salary Allowance * Age Allowance Salary :
Salary Value
Under $10,000 0
$10,001 to $25,000 10,000
$25,001 to $50,000 25,000
Over $50,001 50,000
Loan Package
Loan Value
$1,000 package at 8.0% interest 1,000
$5,000 package at 11.5% interest 5,000
$10,000 package at 15.0% interest 10,000
Condition :
If Loan
-
7/27/2019 MELJUN CORTES ITC 32
24/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
OUTPUT
LOAN.PHP
Page 24 of 26
-
7/27/2019 MELJUN CORTES ITC 32
25/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
GRADED EXERCISE #10:
CASE STUDYSTUDENTS MONITORING SYSTEM
Database Name: dbSurname ex. dbLastNameTable Name: tblStudentsStructure:
Column Field Type/Size
id int not null Auto increment Primary key
Studentnum varchar(9) not null
Lastname varchar(30) not null
Firstname varchar(30) not null
Course varchar(30) not nullBirthday date not null
emailadd varchar(50) not null
Contact varchar(20) not null
graduating varchar(1) not null
Units_num int(5) not null
tblAdmin
Column Field Type/Size
id int not null
Username varchar(25) not null
Password Varchar(25) not nulluserlevel int Not null
Date_reg datetime not null
Note: Sample LevelLevel 0 = Administrator
1 = Super User2 = Power User3 = User
Create a Student Monitoring System having the following:
1. Homepage2. View3. Add4. Delete with confirmation5. Update6. Print (for Report)7. Validation8. Login Form with user level9. Disabling back button10. Session
Page 25 of 26
-
7/27/2019 MELJUN CORTES ITC 32
26/26
JOSE RIZAL UNIVERSITY Computer Science Department
ITC 32 Web Based TechnologiesLABORATORY EXERCISES
11. Audit Trail