Professional Documents
Culture Documents
quiz system
By
1
ASSIGNMENT SPECIFICATION
2
CONCEPTUAL MODEL
Entity types
Legend: Table, Primary Key, foreign key, attribute
3
DATA MODELS
Table User
Table Quiz
Table Quiz_question
Table Quiz_grade
Table Quiz_time
4
Table Like
Table Category
Integrity Restrictions:
State Analysis
5
5. Functional Analysis
2. Quiz management
Table: Quiz, Category, Quiz_question
Responsibility: Creator
• 2.1 New quiz
• 2.2 Update quiz
• 2.3 Delete quiz
• 2.4 Add new quiz questions
Table: Quiz question, Quiz
• 2.5 Update quiz question
• 2.6 Delete quiz question
6
3. List of Quiz
Table: all
• 3.1 Get Quiz from a selected category
• 3.2 Get Quiz from a selected creator by
login id
• 3.3 Get Quiz by above a certain number
of like
• 3.4 Get Quiz that a selected User
haven’t take
• 3.5 Get Quiz from a selected user by
order of grading
• 3.6 Get the Quiz with most question
4. List of takers
Table: all
• 4.1 Get list of User that finished a
selected quiz
• 4.2 Get list of User by order of grade of
all quiz that they have finish
• 4.3 Get list of User that are most active
from a selected category
• 4.4 Get the top user from a selected
quiz
• 4.5 print users that finish a selected test
with the time they take to finish
• 4.6 record grade, timestarted,
timefinsihed
7
5. Category management
Table: Category, Responsibility: Admin
• 5.1 New category
• 5.2 Category update
• 5.3 Category delete
• 5.4 list of categories
8
• 3.3 Get Quiz by above a certain number
of like
Parameter: $NumberofLike
Create or replace Procedure Get_Quiz_by_list(NumberofLike in int)
is
CURSOR C_Quiz is select id_quiz, name from Quiz;
Cursor C_like is select quiz_id_quiz, numberoflike from "Like";
V_Quiz C_Quiz%rowtype;
V_like C_like%rowtype ;
V_total int;
Begin
Open C_Quiz;
Loop
V_total := 0;
Fetch C_Quiz into V_Quiz;
Open C_like;
Loop
Fetch C_like into V_like;
If V_like.Quiz_id_quiz = V_Quiz.id_quiz
Then V_total := V_like.numberoflike + V_total;
End if;
9
End LOOP;
Close C_Like;
EXCEPTION
WHEN OTHERS THEN ROLLBACK ;
END;
10
V_User C_User%rowtype;
V_total int;
Begin
Open C_User;
Loop
V_total := 0;
Fetch C_User into V_User;
Open C_Quiz;
Loop
Fetch C_Quiz into V_Quiz;
If V_User.id_user = V_Quiz.user_id_user
Then
IF V_Quiz.grade is not NUll
then
V_total := V_quiz.grade + V_total;
End if;
End if;
End LOOP;
Close C_Quiz;
DBMS_OUTPUT.put_line(V_User.name || V_Total );
END LOOP;
Close C_User;
EXCEPTION
WHEN OTHERS THEN ROLLBACK ;
END;
11
• 4.5 print users that finish a selected test
with the time they take to finish
Parameter: p_quizName
12
V_time := V_quiz.time_started - V_quiz.time_finished;
End if;
End if;
End LOOP;
Close C_Quiz;
DBMS_OUTPUT.put_line(V_User.name || V_Time );
END LOOP;
Close C_User;
EXCEPTION
WHEN OTHERS THEN ROLLBACK ;
END;
6.1 Menu
1. Quiz taking (responsibility: taker)
(a) Take a Quiz – action 4.6
13
4. Administration( responsibility: Admin)
(a) User Management – see 1 in function
(b) Category management
14