This exercise is based on arrays and methods concepts that you have learned in the class. You are required to develop a simple Student Result Database that will store the result of one course/subject only, for example the result of your class. The database must store three things for each student:
Student Name (must be a string)
Marks obtained (must be a floating-point number), and
Grade received (must be a single character)
Use three different arrays to store the student data. One array to store student name, next to store the marks obtained by each student, and another to store the grade received by each student.
(NOTE: You are free to use conventional Java arrays for this assignment but it is strongly advised that you must either use an ArrayList class or a Vector class of Javas collection framework available in the java.util package. For further references please see you handout # 6)
The marks obtained by each student must be in between 0 and 100. If the user attempts to enter marks that are below zero or above 100 the program must generate a warning to the user indicating that invalid the marks have been entered. However at that stage we are not concerned with if the user enters anything else other than an integer value. The program must repeatedly ask the user for the marks until the valid marks have been entered by the user.
Once the program has received valid marks for a particular student it then automatically calculate the student grade and store it against each student. The grade must be calculated according to the following grading scale.
If marks are between 80 to 100 then A grade
If marks are between 70 to 79 then B grade
If marks are between 60 t0 69 then C grade
If marks are between 50 to 59 then D grade
If marks are below 50 then F grade
You program must provide the following functionality:
1. inutStudentData( ): This function must ask the user to enter only two things for each student that is student name and the marks obtained by each student. The function must not ask for the grade. Grade must be automatically calculated by some other function perhaps char calculateGrade( int ) function.
2. char calculateGrade( int ): This function takes an integer value as parameter that is obviously the marks obtained by the student. It then calculates the grade according to the grading scale mentioned above and returns the grade.
3. viewResult( ): This function must print the result of all student, in tabular format, that exist in the database. For example:
Course: Java Programming I
Teacher: Fawad Ishaq
=== Student Name
========= Marks Obtained
========== Grade Received
1. Hammad Ali 81 A
2. Rizwan Ali 83 A
3. Usman Zeb 75 B
4. sortByName( ): This function must sort the database in ascending order of student names.
5. sortByMarks( ): This function must sort the database in ascending order of marks.
6. sortByGrade( ): This function must sort the database in descending order of grade.
7. searchByName( String name ): This function must search the entire database for the student name it receives as a parameter. If the student is found in the database the program must print his/her result otherwise the program must generate an appropriate warning to a user. If some how your database contains two or more students with exactly the same name the function must print them all.
8. searchByGrade( char grade ): This function takes student grade as a parameter, searches the entire database, and then prints all those students that have this grade.
9. searchMarksBetween( int upper, int lower ): This function takes and range of marks as parameter and prints all those students whose marks are in range specified by the user.
10. removeRecord( string name ): This function takes student name as parameter and removes the matching records permanently from the database. The program must ask for confirmation before deleting the record. If the record is not found the program must generate and appropriate warning to the user.
11. summary( ): This functions will print the result summary for the whole class. The function will print the following things:
number of students who have passed the couse
number of students who have failed the course
number of As, Bs, Cs and so on
maximum marks of the class
minimum marks of the class
(NOTE: You are free to add more methods in your program if you feel necessary for providing the required functionality. However you must provide the above listed methods. Leaving or skipping any method will result in the deduction of marks.)
Your program must provide the following user interface
Search By Name
Search By Grade
Sort By Name
Sort By Marks
Sort By Grade