Fall 2019 Term – Session 01 (#1791) –
Individual Assignment 5
For each procedure, turn in the following:
o
Turn spool on, then run the procedure with several values. Turn spool off.
o
Turn in a copy of the code
o
Turn in a copy/results of the spool file (showing the output).
·
Prerequisites:
o
Run the following script: hw5ScriptEnrollment.sql
·
ER Diagram
o The script will create the following tables and relationships
Complete the following
Tutorial 7
1.
Create a
procedure, ENROLL_STUDENT(pStudent, pClass), to enroll a student to the course. Assume user enters valid data.
2.
Some courses
require a student to be a Sophomore, Junior, or Senior in order to enroll. Enhance the above procedure to ensure that
students have appropriate academic standing (student standing is equal to or
greater than course standing), call it ENROLL_STUDENT2.
3.
In each
semester, a student can enroll in a maximum of 15 class hours. Create a procedure, ENROLL_STUDENT3(pStudent,
pClass), that will enroll a student as
long as the enrollment does not violate the maximum of 15 class hours
condition.
Note:
Create this procedure independent of the
class standing requirement.
4.
A student’s
standing is determined by the total credit hours earned for all classes, as
follows:
0 – 30: Freshmen
31 – 60: Sophomore
61 – 90: Junior
91 and above: Senior
Create a procedure, UPDATE_STANDING(pStudent), that will
update a student’s standing.
5.
A student
must earn an A, B, or C in a class in order get credit for the course
hours. Grades of D, F, or W do not
count. Enhance the above procedure to
only count courses where the student earned an A, B, or C, call it UPDATE_STANDING2
6.
Each course
has a capacity limit. Create a procedure,
ENROLL_STUDENT4(pStudent, pClass), that will only add the student if the course is kept within the
capacity limitation.
Note: This requirement is independent of previous ENROLL_STUDENT procedures you created.
7.
Create a
procedure, UPDATE_GPA(pStudent), that will
update a student’s GPA. The GPA is
calculated as follows:
A – 4 points
B – 3 points
C – 2 points
D – 1 point
Others – 0 points.
Use the above points and a weighted average based on the course
credit hours. For example, a student
earned the following grades:
A – 3 credit hour class
B – 3 credit hour class
C – 1 credit hour class.
The GPA is (4 * 3 + 3 * 3 + 2 * 1) / (3 + 3 + 1) = 3.29
8.
Create a
procedure, VALIDATE_CLASSID(pClass), that will
check if the class exists in the CLASS_SCHED table. If the student is found, display “Student
Found! Valid ID.”, else display “Student
NOT Found! Invalid ID.”
9.
Create a
procedure, VALIDATE_STUDENT(pStudent), that will
check if a student exists in the STUDENT table.
If the class is found, display “Class ID Found! Valid ID.”, else display “Class ID NOT
Found! Invalid ID.”
10.
Create a
procedure, DROP_STUDENT4(pStudent, pClass), that will drop the student from a course. If the student is enrolled in the class,
update the grade to a “W”, otherwise, display an error message.
11.
Create a
procedure, CONFLICT(pStart1, pEnd1, pStart2, pEnd2), that checks for class schedule conflicts. All input parameters are numeric. pStart1 and pEnd1 are the start
and end times for class 1. pStart2
and pEnd2 are the start and end times for class 2. If there is a conflicts, display that a
conflict exists, otherwise, display that no conflict exists.
Get Free Quote!
356 Experts Online