
Patrick B. answered 11/21/20
Math and computer tutor/teacher
I'm sorry it is still not 100% clear, but a little better...
I really do not want to code anything until the design is
100% CRYSTAL CLEAR!!!
It sounds like you want the class test=30% , sessional=40%, and innovative
assignment=30% as WEIGHTED averages.
So then....
for each student, with a UNIQUE Roll #
there are 2 or more grades in the class test category,
2 or more grades in the sessional category,
2 or more grades in the innovative assignment category
the averages are calculated for EACH of these THREE categories..
THEN:
FINAL SCORE = 0.3 * test average + 0.4 * sessional average + 0.3 * innovative average
What is unclear is the student must score 40% on EACH Category or
40% OVERALL in order to pass...
Besides the failure report, what other reports are required?
The one specified in the 3rd bulleted spec, sorted by Roll #, has column headers:
roll # test sessional innovative score
However, there should be a secondary report BEHIND this one that shows,
for a GIVEN student, the grades for each component, which supports and
backs up, the reported average of each component...
Finally, as these scores and grades are input, there should be another
table that records the date-time stamp of each input and/or edit...
This incurs and brings about yet another report...
Finally, under this approach, it is likely that students will NOT
have the same # of assignments for each category. This results in
a "JAGGED" array which is VERY FROWNED UPON as it is not fair.
Also the DELETION of grades is also a BIG NO-NO
If I am on the right track, then here is my suggested design:
class GradeVector
-----------------
members: double grades;
int # of grades
methods:
GetNumGrades();
InsertAddNewGrade();
IndexerGetIndexAt();
FindLinearSearch();
IndexerSetIndexAt(); <-- needs to be audited
//RemoveDeleteGrade(); <-- maybe, not recommended
GetAverage();
class Student
-------------
members: String name;
long rollNum;
char DOB[3];
methods:
getters and setters
class StudentGrades
-------------------------------
members:
Student student;
GradeVector Grades[3]; /* satifies the nested array requirement;
Grades[0] is the grades vector for the tests component
Grades[1] is the grades vector for the sessional component
Grades[2] is the grades vector for the innovative assignment component */
methods:
IndexerGetGradesComponentAt(); //returns the Grades vector for the specified component
CalculateWeightedAverage();
Perhaps:
class Course
---------------
members: long courseID
StudentGrades A[];
indexerGetIndexAt()
Finally for the satisfaction of the inheritance requirement,
you can create a custom exception to be thrown if a negative
score is input..