At a given point of time we need to allocate a course to an educator for a given
period. Before allocating a course to an educator the following conditions are to be checked.
1. Enough number of students have registered for the course
AND
2. The course is added into the educator’s skill set
AND
3. Educator’s calendar is free for the given period
AND
4. Educator is not on leave for the given period
And
5. Educator has not yet completed his delivery targets Or There is no other alternative
SOLUTION :
COURSE_ALLOCATION
1. input course
2. input num_of_students
3. input educator's_skill_set, spare_time, is_on_leave, delivered_targets, allocation
4. if ( (num_of_students > min_number_students) && (educator's_skill_set = course) && (spare_time = true ) && (is_on_leave = false) && (delivered_targets = true ) ) then
5. set allocation = true
6. end if
7. display "Course is allocated. "
8. end
Problem 2: For a student, following is the course qualifying criteria.
1. Student has registered for the course
2. Attended at-least 80% of the classes
or attended at-least 60% of the classes and submitted medically unfit certificate
3. Submitted all the assignments
4. Completed project
5. Scored 80% marks in the test or the retest
QUALIFYING_STUDENT
1. input classes_attended, min_score
2. input course_reg, medical_certificate, submitted_assignments, completed_project
3. if ( ( course_reg = true ) &&(classes_attended >= 80 || (classes_attended >= 60 && medical_certificate = true ) ) && (submitted_assignments = true ) && (completed_project = true) && ( min_score >= 80)) then
4. set course_qualification = true
5. end if
6. display "Congratulations, course has been qualified. "
7. end
Assignment 2.2.3: Selectional pattern (3)
Objective: To use the problem solving techniques learnt so far in a real life application.
Problem 1: Take marks of a trainee in a module as input and calculate the grade and
grade points. The grade table is given below:
SOLUTION :
CALC_GRADE
1. input marks_obtained
2. if ( marks_obtained >= 80 ) then
3. grade_point = 5
4. grade = A
5. elseif ( marks_obtained >= 73 && marks_obtained <=79 ) then
6. grade_point = 4.5
7. grade = B+
8. elseif ( marks_obtained >= 65 && marks_obtained <=72 ) then
9. grade_point = 4
10. grade = B
11. elseif ( marks_obtained >= 55 && marks_obtained <=64 ) then
12. grade_point = 3
13. grade = C
14. elseif ( marks_obtained >= 0 && marks_obtained <=54 ) then
15. grade_point = 2
16. grade = D
17. end if
18. display " The grade points obtained are equal to: ", grade_point
19. display " The grade awarded is : ", grade
20. end
Problem 2 :
Take marks of a trainee in all generic modules (listed below)as input and calculate the
Generic GPA. The method for calculating Generic GPA is as follows:
Grade points for marks are given in previous problem and credit points are as follows:
SOLUTION :
CALC_GPA
1. input marks_obtained
2. if ( marks_obtained >= 80 ) then
3. grade_point = 5
4. grade = A
5. elseif ( marks_obtained >= 73 && marks_obtained <=79 ) then
6. grade_point = 4.5
7. grade = B+
8. elseif ( marks_obtained >= 65 && marks_obtained <=72 ) then
9. grade_point = 4
10. grade = B
11. elseif ( marks_obtained >= 55 && marks_obtained <=64 ) then
12. grade_point = 3
13. grade = C
14. elseif ( marks_obtained >= 0 && marks_obtained <=54 ) then
15. grade_point = 2
16. grade = D
17. end if
18 GPA = ( marks_obtained * grade_point ) / marks_obtained
19. display " The grade points are : ", grade_point
20. display " The GPA obtained : ", GPA
21. end