Modify Part 3 by: ? create separate arrays to store the homework, quiz, project,
ID: 3713481 • Letter: M
Question
Modify Part 3 by:
? create separate arrays to store the homework, quiz, project, discussion and exam grades
The user input still needs to be validated. Use both modules and functions. USE PSEUDOCODE!
Part 3:
//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
homeworkScore()
Points obtained in each of the N(given as 14 here) Chapters
Returns total score in homework assignment out of 100
'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
Initialization: Set sum=0, maxHomework = n*100;
for (iter = 1,2...14) enter the chap_points for each chapter between 1 to 100
if the input of any chap_point(1..14) not between 1 to 100 repeat step 1a.
for (iter = 1,2...n)
sum = sum + chap_points(iter)
score = (sum/maxHomework)*100
return score
examScore()
Points obtained in each of the N(given as 4 here) Exams
Returns total score in Exam out of 100
'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
Initialization: Set sum=0, maxExam = 4*100
for (iter = 1,2...4) enter the exam_points for each exam between 1 to 100
if the input of any exam_points(1..4) not between 1 to 100 repeat step 1a.
for (iter = 1,2...n)
sum = sum + exam_points(iter)
score = (sum/maxExam)*100
return score
quizScore()
Points obtained in each of the N(given as 14 here) Quiz
Returns total score in Quiz assignment out 100
'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
Initialization: Set sum=0, maxQuiz = 14*100
for (iter = 1,2...14) enter the quiz_points for each quiz between 1 to 100
if the input of any quiz_points(1..14) not between 1 to 100 repeat step 1a.
for (iter = 1,2...n)
sum = sum + quiz_points(iter)
score = (sum/maxQuiz)*100
return score
discussionScore()
Points obtained in each of the N(given as 4 here) discussions
Returns total score in discussion assignment
'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
Initialization: Set sum=0, maxDiscussion = 4*100
for (iter = 1,2...4) enter the discussion_points for discussion between 1 to 100
if the input of any discussion_points(1..4) not between 1 to 100 repeat step 1a.
for (iter = 1,2...n)
sum = sum + discussion_points(iter)
score = (sum/maxDiscussion)*100
return score
projectScore()
Points obtained in each of the N(given as 6 here) Projects
Returns total score in Project assignment
'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
Initialization: Set sum=0, maxProject = 6*100;
for (iter = 1,2...6) enter the project_points for each project between 1 to 100
if the input of any project_points(1..6) not between 1 to 100 repeat step 1a.
for (iter = 1,2...n)
sum = sum + project_points(iter)
score = (sum/maxProject)*100
return sum
finalScore() calls each of the five modules above to calculate total score of each assignment to calculate the final score
Returns Final score of a student out of 100
'final_score' stores final score
Initialization: Set total_score=0
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
final_score = (15/100)*homeworkScore() + (60/100)*examScore() +
(5/100)*quizScore() + (5/100)discussionScore() + (15/100)*projectScore()
return final_score
Grade() calls the function finalScore() to obtain the final score of a student
Returns letter grade for the final score obtained by a student
'final' is the final score of a student, grades: A+ A B+ B C+ C D
final = finalScore()
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
Hi Dear,
Please find my 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
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.