Question: Write a Java program that Declares two arraylists, aCategory to store Name of an assessment - category, aWeight to store corresponding weightage of the assessment
Write a Java program that
Declares two arraylists,
aCategory to store Name of an assessmentcategory,
aWeight to store corresponding weightage of the assessment category to be used in student grade evaluation.
Takes following inputs from the user till sum of weightages is exactly and stores the input values in respective arraylists:
Name of assessment category for a course and
weightage applicable in case of the assessment category.
Calls a method to check if the sum of weightages is exact else throws an exception.
Takes name of file, filename, as input from the user to write studentrecords.
Calls a method writeFile with filename, aCategory as input arguments and number of Student Records, sRecords, as output parameter.
Method writeFile takes inputs from the user iteratively till user wants to add the records. Inputs taken from the user are:
Student ID studentID
Points obtained by the particular student in each of assessment category as listed in the aCategory.
Method writeFile counts and writes the records, each one consisting of studentID and corresponding points obtained by the student in each of the assessment categories, to the file, filename.
Method writeFile returns the number of records written in filename as output parameter.
Calls a method readWriteFile with filename, sRecords, aCategory, aWeight as input parameters.
Method readWriteFile declares a D Array, sPointsArray with rows sRecords and columns as number of elements in arraylist aCategory to store points obtained by the student in each of the assessment categories.
Method readWriteFile takes input opFilename as String from the user to write the student grades.
Method readWriteFile opens the output file opFilename to write students calculated grade points.
Method readWriteFile opens the input file filename and executes following commands till end of the file:
reads studentID as a String and reads points obtained by the student in each of the assessment categories in array sPointsArray.
calls method calcGrade with sPointsArrayi aWeight as input parameters and receives double sGrade as output parameter.
readWriteFile writes studentID and sGrade into the opFilename.
readWriteFile prints following output on screen after writing every record to opFilename:
Student record of studentID entered with weighted average: sGrade
Method calcGrade takes double sPointsArray, ArrayList aWeight as input arguments and returns double sGrade as output parameter.
sGrade is calculated as:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
