Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PART 3 Modify part 2 by using both modules and functions appropriately. You also

ID: 3706236 • Letter: P

Question

PART 3

Modify part 2 by using both modules and functions appropriately. You also need to validate the user’s input. The scores have to be numeric and between 0 and 100. USE ONLY PSEUDOCODE! Do not use any other programming language.

Part 2:

Function: homeworkScore()
Input: Points obtained in each of the N(given as 14 here) Chapters
Output: Returns total score in homework assignment out of 100
Notations: 'sum' stores total Points obtained in homework, 'N' is the number of chapters,
'chap_points' is an array with points of each chapter, 'score' is the score obtained in homework assignment, 'maxHomework' is total score possible in homework assignment
1.Initialization: Set sum=0, maxHomework = n*100;
2.for (iter = 1,2...n)
sum = sum + chap_points(iter)
3.score = (sum/maxHomework)*100
4.return score

Function: examScore()
Input: Points obtained in each of the N(given as 4 here) Exams
Output: Returns total score in Exam out of 100
Notations: 'Sum' stores total points obtained in exams, 'N' is the number of Exams,
'exam_points' is an array with points of each Exam, 'score' is the score obtained in exam
'maxExam' is total score possible in homework assignment

1.Initialization: Set sum=0, maxExam = 4*100
2.for (iter = 1,2...n)
sum = sum + exam_points(iter)
3.score = (sum/maxExam)*100
4.return score


Function: quizScore()
Input: Points obtained in each of the N(given as 14 here) Quiz
Output: Returns total score in Quiz assignment out 100
Notations: 'Sum' stores total Quiz score, 'N' is the number of Quiz,
'quiz_points' is an array with points of each Quiz, 'score' is the score obtained in Quiz assignment
'maxQuiz' is total score possible in Quiz assignment

1.Initialization: Set sum=0, maxQuiz = 14*100
2.for (iter = 1,2...n)
sum = sum + quiz_points(iter)
3.score = (sum/maxQuiz)*100
4.return score

Function: discussionScore()
Input: Points obtained in each of the N(given as 4 here) discussions
Output: Returns total score in discussion assignment
Notations: 'Sum' stores total discussion score, 'N' is the number of discussions,
'discussion_points' is an array with points of each Discussion, 'score' is the score obtained in discussion assignment 'maxDiscussion' is total score possible in discussion assignment

1.Initialization: Set sum=0, maxDiscussion = 4*100
2.for (iter = 1,2...n)
sum = sum + discussion_points(iter)
3.score = (sum/maxDiscussion)*100
4.return score

Function: projectScore()
Input:    Points obtained in each of the N(given as 6 here) Projects
Output:   Returns total score in Project assignment
Notations: 'Sum' stores total Project score, 'N' is the number of chapters,
'project_points' is an array with points of each Project, 'score' is the score obtained in Project assignment 'maxProject' is total score possible in Project assignment

1.Initialization: Set sum=0, maxProject = 6*100;
2.for (iter = 1,2...n)
sum = sum + project_points(iter)
3.score = (sum/maxProject)*100
4.return sum

Function: finalScore() calls each of the five modules above to calculate total score of each assignment to calculate the final score
Output: Returns Final score of a student out of 100
Notations: 'final_score' stores final score

1.Initialization: Set total_score=0
2.Set total maximum for each assignment : number of assignment type*point of each assignment type
maxHomework = 14*100, maxExam = 4*100, maxQuiz=14*100, maxDiscussion=4*100, maxProject = 6*100
3.final_score = (15/100)*homeworkScore() + (60/100)*examScore() +
(5/100)*quizScore() + (5/100)discussionScore() + (15/100)*projectScore()
4.return final_score

Function: Grade() calls the function finalScore() to obtain the final score of a student
Output: Returns letter grade for the final score obtained by a student
Notation: 'final' is the final score of a student, grades: A+ A B+ B C+ C D
1.final = finalScore()
2.if final>=90
return A+
else if final<90 AND final>=80
return A
else if final<80 AND final>=70
return B+
else if final<70 AND final>=60
return B
else if final<60 AND final>=50
return C+
else if final<50 AND final>=40
return C
else
return D

Explanation / Answer

//The algorithm is modified as per the assumption all the scores obtained will be input by the user so each and every //scores are input by the user

Function: homeworkScore()
Input: Points obtained in each of the N(given as 14 here) Chapters
Output: Returns total score in homework assignment out of 100
Notations: 'sum' stores total Points obtained in homework, 'N' is the number of chapters,
'chap_points' is an array with points of each chapter, 'score' is the score obtained in homework assignment, 'maxHomework' is total score possible in homework assignment
1.Initialization: Set sum=0, maxHomework = n*100;

1a.for (iter = 1,2...14) enter the chap_points for each chapter between 1 to 100

1b.if the input of any chap_point(1..14) not between 1 to 100 repeat step 1a.
2.for (iter = 1,2...n)
sum = sum + chap_points(iter)
3.score = (sum/maxHomework)*100
4.return score

Function: examScore()
Input: Points obtained in each of the N(given as 4 here) Exams
Output: Returns total score in Exam out of 100
Notations: 'Sum' stores total points obtained in exams, 'N' is the number of Exams,
'exam_points' is an array with points of each Exam, 'score' is the score obtained in exam
'maxExam' is total score possible in homework assignment

1.Initialization: Set sum=0, maxExam = 4*100

1a.for (iter = 1,2...4) enter the exam_points for each exam between 1 to 100

1b.if the input of any exam_points(1..4) not between 1 to 100 repeat step 1a.

2.for (iter = 1,2...n)
sum = sum + exam_points(iter)
3.score = (sum/maxExam)*100
4.return score


Function: quizScore()
Input: Points obtained in each of the N(given as 14 here) Quiz
Output: Returns total score in Quiz assignment out 100
Notations: 'Sum' stores total Quiz score, 'N' is the number of Quiz,
'quiz_points' is an array with points of each Quiz, 'score' is the score obtained in Quiz assignment
'maxQuiz' is total score possible in Quiz assignment

1.Initialization: Set sum=0, maxQuiz = 14*100

1a.for (iter = 1,2...14) enter the quiz_points for each quiz between 1 to 100

1b.if the input of any quiz_points(1..14) not between 1 to 100 repeat step 1a.

2.for (iter = 1,2...n)
sum = sum + quiz_points(iter)
3.score = (sum/maxQuiz)*100
4.return score

Function: discussionScore()
Input: Points obtained in each of the N(given as 4 here) discussions
Output: Returns total score in discussion assignment
Notations: 'Sum' stores total discussion score, 'N' is the number of discussions,
'discussion_points' is an array with points of each Discussion, 'score' is the score obtained in discussion assignment 'maxDiscussion' is total score possible in discussion assignment

1.Initialization: Set sum=0, maxDiscussion = 4*100

1a.for (iter = 1,2...4) enter the discussion_points for discussion between 1 to 100

1b.if the input of any discussion_points(1..4) not between 1 to 100 repeat step 1a.

2.for (iter = 1,2...n)
sum = sum + discussion_points(iter)
3.score = (sum/maxDiscussion)*100
4.return score

Function: projectScore()
Input:    Points obtained in each of the N(given as 6 here) Projects
Output:   Returns total score in Project assignment
Notations: 'Sum' stores total Project score, 'N' is the number of chapters,
'project_points' is an array with points of each Project, 'score' is the score obtained in Project assignment 'maxProject' is total score possible in Project assignment

1.Initialization: Set sum=0, maxProject = 6*100;

1a.for (iter = 1,2...6) enter the project_points for each project between 1 to 100

1b.if the input of any project_points(1..6) not between 1 to 100 repeat step 1a.

2.for (iter = 1,2...n)
sum = sum + project_points(iter)
3.score = (sum/maxProject)*100
4.return sum

Function: finalScore() calls each of the five modules above to calculate total score of each assignment to calculate the final score
Output: Returns Final score of a student out of 100
Notations: 'final_score' stores final score

1.Initialization: Set total_score=0
2.Set total maximum for each assignment : number of assignment type*point of each assignment type
maxHomework = 14*100, maxExam = 4*100, maxQuiz=14*100, maxDiscussion=4*100, maxProject = 6*100
3.final_score = (15/100)*homeworkScore() + (60/100)*examScore() +
(5/100)*quizScore() + (5/100)discussionScore() + (15/100)*projectScore()
4.return final_score

Function: Grade() calls the function finalScore() to obtain the final score of a student
Output: Returns letter grade for the final score obtained by a student
Notation: 'final' is the final score of a student, grades: A+ A B+ B C+ C D
1.final = finalScore()
2.if final>=90
return A+
else if final<90 AND final>=80
return A
else if final<80 AND final>=70
return B+
else if final<70 AND final>=60
return B
else if final<60 AND final>=50
return C+
else if final<50 AND final>=40
return C
else
return D