Question
Designing a class named grader. This class has no instance variables. Instead it has at least these methods or functions: ? determines if a number
Designing a class named grader. This class has no instance variables. Instead it has at least these methods or functions:
? determines if a number is numeric and within a specific range. Example: validates that a score is numeric and with 1 and 100.
? calculates the sum of all values in a one-dimensional numeric array and determines the final percentage score Example: There are 5 scores that add up to 300 out of a possible 500 and this is 15 percent of the grade: 300/500*15 = 9
? determines the letter score based on a numeric value between 0 and 100.
You can decide whether these are methods or functions and what parameters they require. You can also add more methods or functions as you see fit. Modify the pseudocode solution below by using the methods/functions in the grader class to determine the final letter grade you have to print to the file.
//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
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started