Task Description
You are going to create a grader system application.
This application will read the Name, Registration Number and Answers of various True/False questions stored in a result.txt file.
A answerKey.txt file is also provided that have the correct answers to all the questions.
Your program will read the data from the result.txt file and store them in Student objects.
A grader application will check the answers stored in Student objects with the answer provided in answerKey.txt file and calculate the result of each student and store its marks and grade into student object.
The grades are assigned on the same formula as your grades in COMSATS university means A grade for 90% marks, A- for 85% marks and so on.
You will create your own custom exception called FailException, that will be thrown in case a student secured less then 50% marks.
The data stored in students object will finally be write on a output.txt file.
The total project will consist of following classes and interfaces that you will have to complete in order to get a working grader application.
Your submission should be exactly matching with this project structure.
Create a project in your IDE, write the name of your project in following format Qasim001BEE3A, means your name, registration number, program name and section all information should be covered in the project name
Create an Interface FileOperations in your project that has following five methods
a. OpenFile():void
b. readResultFile():void
c. readKeyFile():void
d. writeResultFile():void
e. closeFile():void
Create an Interface ResultCalculation in your project that has following method
a. gradeCalculation():void
Create a class Student that holds the following information
a. name:String
b. regNo:String
c. ans1:String
d. ans2:String
e. ans3:String
f. ans4:String
g. ans5:String
h. ans6:String
i. ans7:String
j. ans8:String
k. ans9:String
l. ans10:String
m. answers:String[]
n. grade:String
o. marks:int
Encapsulate the Student class, and Provide the implementation of toString() method in Student class.
Create a custom exception called FailException.
Create a Grader class that will implements the FileOperations and ResultCalculation interface.
Create the text file named key.txt and result.txt in your project directory that has the following data
Now write the appropriate code inside OpenFile() method in Grader class that will use Scanner class to Open the key.txt and result.txt file.
Now write the appropriate code using Scanner class API inside the readResultFile() method in Grader class, this code will read the data stored in result.txt file that was opened in OpenFile() function. This data will be passed to create the two objects of Student class. For example Qasim will be stored as name of Student object, 001 will be stored as regNo of Student object, T will be stored as ans1 in Student Object, F will be stored in ans2 in Student Object, and so on. After the first line again the same process will repeat and another Student object will be created to store the information written in line 2 of result.txt file
Now write the appropriate code using Scanner class API inside the readKeyFile() method in Grader class, this code will read the data stored in key.txt file that was opened in OpenFile() function. This data will be stored in an answer key Array. The first digit 10 in the key.txt file will be used to determine the size of answer key array.
Now write the appropriate code inside the method for gradeCalculation(). This code will calculate the marks based on answer key data and the data stored in Student objects. Each correct answer will be awarded 10 marks and each wrong answer will be awarded 0 marks. Based on total marks Assign the appropriate grade letter.
Throw the FailException object if a student will get less than 50 marks.
Now write the appropriate code using Formatter API inside the writeResultFile() method, this code will write the Name, RegNo, Marks and Grade details into a output.txt file. The output will be in the following format as shown in figure.
Write appropriate displayKey() and displayResult() methods in Grader class to show the data stored after reading from file.
Encapsulate the Grader class.
write appropriate code inside the closeFile() method that will close the key.txt, result.txt and output.txt files (if already opened)
Create a Test class that will have main method. Inside the main method create an object of Grader class and call the functions in the order as shown in figure below.
The result of the execution should be as shown in figure below
You are going to create a grader system application. This application will read the Name, Registration Number and Answers of various True/False questions stored in a result.txt file. A answerKey.txt file is also provided that have the correct answers to all the questions. Your program will read the data from the result.txt file and store them in Student objects. A grader application will check the answers stored in Student objects with the answer provided in answer Key.txt file and calculate the result of each student and store its marks and grade into student object. The grades are assigned on the same formula as your grades in COMSATS university means A grade for 90% marks, A- for 85% marks and so on. You will create your own custom exception called FailException, that will be thrown in case a student secured less then 50% marks. The data stored in students object will finally be write on a output.txt file. The total project will consist of following classes and interfaces that you will have to complete in order to get a working grader application. QasimO 1BEE3A FalException.java FleOperations.java Grader.java ResultCalculation.java Student.java Test.java You are going to create a grader system application. This application will read the Name, Registration Number and Answers of various True/False questions stored in a result.txt file. A answerKey.txt file is also provided that have the correct answers to all the questions. Your program will read the data from the result.txt file and store them in Student objects. A grader application will check the answers stored in Student objects with the answer provided in answer Key.txt file and calculate the result of each student and store its marks and grade into student object. The grades are assigned on the same formula as your grades in COMSATS university means A grade for 90% marks, A- for 85% marks and so on. You will create your own custom exception called FailException, that will be thrown in case a student secured less then 50% marks. The data stored in students object will finally be write on a output.txt file. The total project will consist of following classes and interfaces that you will have to complete in order to get a working grader application. QasimO 1BEE3A FalException.java FleOperations.java Grader.java ResultCalculation.java Student.java Test.java