Description
Background
The niversity of lorida nglish department has asked you to create an autograder for its introductory class. There are many types of students who are taking this class. Some are highachieving High School students, some are niversity of lorida Undergraduate students, and some are Graduate students who need a refresher. They would like to create a parent (base) Class that can be extended to provide functionality for various kinds of students. The department has specifically asked for the ability to supply the name of the file containing a student’s essay (the students’ I number.txt) and have the program grade the essay, by listing all the misspelled.
Objective
● Read in the file given ● Store each misspelled word ● List all misspelled words ● Generate an output file that contains the student’s graded feedback
Your Assignment You will need to create five files complete this project and name them exactly as follows: , , , , , , Project5.java Student.java files have been provided, and it’s your responsibility not to modify them. If you modify them, you will most likely fail the grading
program. ach of the .java files and their associated classes are described as below:
Project5.java (Do not modify, or you will fail the grading)
The Project5 Class will hold the main method of your program. We have already implemented that for you. Generally, it will: ● ask you to input the dictionary name ● load the dictionary ● Grade the students’ essays (in a loop) based on the student I (input from the keyboard). ● Terminate when is typed in for student I. o not modify this class. It provides you an entry point and a skeleton from which to start your project. If the other five required classes have not been correctly implemented, it’s highly possible that your program will fail to compile. Also, you can add your own methods in addition to the mandatory methods and fields in the five required classes. Please do not change the method signature to handle exceptions. You should surround any code that may throw an exception in a trycatch block. The exceptions should not be raised to the main method.
Dictionary.java
The dictionary class will load the dictionary from a dictionary file, and be used to check misspellings. The class must have the following members with the exact same signatures: ● A data field to hold the words from the dictionary ○ ● A method that returns the number of words in the loaded dictionary ○ ● A method which will load the dictionary file based on the file name. You may assume the dictionary file is in the same folder as the ictionary class. If loading the dictionary succeeds (meaning that the file was found), return true. Otherwise return false. ○ ● A method which being used to check whether a given word is in the dictionary. If the word is in the dictionary, return , otherwise return . In the essay, a word is considered a series of letters, separated by spaces. As long as the word, exactly as given, is found in the dictionary, we will consider it to be correct. If a word is not in the dictionary, it will be considered as a misspelling. For example, if you pass in the word “cat’s”, you will see that “cat” is in the dictionary, however “cat’s” is not. In this case, “cat’s” will be considered as misspelling. Please follow this rule. DO not make up your own rule. ○
Grader.java
The Grader class will contain a ictionary object and use it to grade a student’s essay from the essay file. The class must have the following members with the exact same signatures:
● ields for the following attributes ○ ■ This variable indicates whether the student variable in the Grader class is holding a Student instance ○ ■ ariable which holds the graded student instance ○ ■ ariable which holds the dictionary instance ● A constructor which will pass in a created dictionary instance, then initialie the local dict field ○ ● A method which will grade the given student essay based on passed in student file name. The grading criteria is explained in the Dictionary class. You should use the isWord() method in the Dictionary class to decide whether a word is misspelled. After parsing the original essay file, the you should instantiate the local variable to an appropriate Class Instance. ○ .g. after parsing the essay file, if you find out that the student is a Graduate Student, the student’s name is FName LName, id is 12345678, school major is Computer Science, advisor is Kyla McMullen. If you have stored all the errors in the variable , Then you should instantiate the appropriate Student Object for the student variable. or example: student=new GraduateStudent(name,id,essay.toString(),errorList,major,advisor). After grading the file and creating the appropriate Student object, the variable should be set to false and the method will return true. Otherwise (e.g. IO errorexception …), the method should return false and reset all local variables except the field by calling method. Important: you should handle all exceptions inside the method. DO NOT throw any exception throw the method, or the mandatory signature will be changed. ○ ● A method to check whether the grader is available to grade next student. available” means that the student field has been set to null and the available variable is true. ○ ● A getter method to get the gradedgenerated student instance ○ ● A method to reset the local variables, excluding the field. When the reset method is called, the student variable should be set to null and the available variable should be set to true ○
Student.java (Do not modify, or you will have compilation errors in grading)
The Student class will act as your parent class from which the different types of students will be derived. This class contains the following members: ● ields for the following attributes ○ ○ ○ ○ ● GetterSetter methods for each attribute ○ ○ ○ ○ ○ ○ ○ ○ ● A method that will format and return all misspelled words in the error list, to be used for printing ○ ● An abstract method being used to write the graded files to file system, which you are supposed to implement in all the subclasses ○ ● A constructor ○ , , ,
HighSchoolStudent.java
The ighSchoolStudent class is a child class of the Student Class. The class must have the following members with the exact same signatures: ● ields for the following attributes ○ ● getter and setter methods ○ ○ ● A method implements the abstract method in parent class, which will write the student’s grading information to the file. ○ ■ The file should be in the same path as all class files. ■ The file name should be named . e.g. if the student’s id is , the generated file name should be ■ In the file, the content should be written as following sequence: (suppose the student’s name is FName LName, id is 12345678, school name is Gainesville High School) ● ● ● ●
● ■ ow to define error words will be discussed in Grader class. ■ Hint: use method in parent Student class to format the error words output. ■ Important: you should handle all exceptions inside the method. DO NOT throw any exception throw the method, or the mandatory signature will be changed. You should enclose the code that may throw the exception within a try/catch block. ● A constructor ○ The constructor must initialie all fields of the Student object, using the constructor’s parameters ■ , , , ,
UndergraduateStudent.java
The ndergraduateStudent Class is a child class of the Student Class. The class must have the following members with the exact same signatures: ● ields for the following attributes ○ ● getter and setter methods ○ ○ ● A method implements the abstract method in parent class, which will write the student’s grading information to the file. ○ ■ The file should be at the same path as all class files. ■ The file name should be . e.g. if the student’s id is , the generated file name should be ■ In the file, the content should be written as following sequence: (suppose the student’s name is FName LName, id is 12345678, school major is Computer Science) ● ● ● ● ● ■ ow to define error words will be discussed in Grader class. ■ Hint: use method in parent Student class to format the error words output. ■ Important: you should handle all exceptions inside the method. DO NOT throw any exception throw the method, or the mandatory signature will be changed. You should enclose the code that may throw the exception within a try/catch block. ● A constructor ○ The constructor must initialie all fields of the Student object, using the constructor’s parameters
■ , , , ,
GraduateStudent.java
The GraduateStudent Class is a child class of the Student Class. The class must have the following members with the exact same signatures: ● ields for the following attributes ○ ○ ● getter and setter methods ○ ○ ○ ○ ● A method implements the abstract method in parent class, which will write the student’s grading information to the file. ○ ■ The file should be at the same path as all class files. ■ The file name should be . e.g. if the student’s id is , the generated file name should be ■ In the file, the content should be written as following sequence: (suppose the student’s name is FName LName, id is 12345678, school major is Computer Science, advisor is Kyla McMullen) ● ● ● ● ● ● ■ ow to define error words will be discussed in Grader class. ■ Hint: use method in parent Student class to format the error words output. ■ Important: you should handle all exceptions inside the method. DO NOT throw any exception throw the method, or the mandatory signature will be changed. You should enclose the code that may throw the exception within a try/catch block. ● A constructor ○ The constructor must initialie all fields of the Student object using the constructor’s parameters ■ , , , , , Sample Essay Files (saved as 11111111.txt)
Sample Essay File (saved as 123456.txt) Sample Essay File (saved as .txt) ,
Sample Output File (saved as 11111111_graded.txt)
Sample Output File (saved as 123456_graded.txt)
Sample Output File (saved as _graded.txt)
Sample Run (input in red)
Submission Requirements
● ip all seven Class files , , , , , , and your extra classes into one single ip file without any folder hierarchy. or verbal and pictorial instructions on how to do that, please refer Project 4 submission requirements. ● The ip fileshould be named where uflI is the alphanumeric portion of your ufl email account that comes before the ufl.edu part. ● Submit on time using Canvas
Notes ❖ When inputting essay files and generating graded output files, make sure they are in teh same folder as all your class files. ❖ If your ip file is not named , your project will not be graded. ❖ If you do not name the items above exactly as specified, where specified, your project will not be graded correctly. ❖ Please convert both the dictionary words and essay words to lowercase and remove all punctuation except the apostrophe () and hyphen () during word comparison. ❖ It is highly recommended that you test your program piece by piece before assembling your final code. You will have a much easier time if you build your program piece by piece rather than trying to write the entire program. If you have
more questions about the project, it is highly recommended to consult your TA at office hours. ❖ Please make sure to mimic the output in the Sample Runs, and your output should be the same as the one in the Sample Runs. More importantly, your file output should follow the format described previously. The grades will be decided by those output files and the implementation of mandatory methods/classes. ❖ Some, unit testing will be made available for this project. You will still need to compare your output file to the correct output.
Grading ● 00 of your grade will be based on your program’s ability to generate proper output (files) and using all of the mandatory methods.