Modify Part 4 by using file input instead of user input. Only process those reco
ID: 3713844 • Letter: M
Question
Modify Part 4 by using file input instead of user input. Only process those records that have no errors. USE PSEUDOCODE!
Filename: ITP100grades.dat
Description: Each record contains the student ID, name and grades for a student.
Field Description:
Student ID
Student Name
Homework Grade 1
Homework Grade 2
Homework Grade 3
Homework Grade 4
Homework Grade 5
Homework Grade 6
Homework Grade 7
Homework Grade 8
Homework Grade 9
Homework Grade 10
Quiz Grade 1
Quiz Grade 2
Quiz Grade 3
Quiz Grade 4
Quiz Grade 5
Quiz Grade 6
Quiz Grade 7
Quiz Grade 8
Quiz Grade 9
Project Grade 1
Project Grade 2
Project Grade 3
Project Grade 4
Project Grade 5
Project Grade 6
Discussion Grade 1
Discussion Grade 2
Discussion Grade 3
Discussion Grade 4
Exam Grade 1
Exam Grade 2
Exam Grade 3
Exam Grade 4
You need to create a new file with the student ID and course grade. These two items need to be separated by a comma.
Part 4:
//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
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.