Question: Java Programming Hello I am having trouble with this class. It uses random access files that I have never used before and cant find any
Java Programming
Hello I am having trouble with this class. It uses random access files that I have never used before and cant find any good examples for. I need help writing the main method. My question, requirements, and current code are below.
RandomAccessDemo Class
1. Creates at least 8 Grade objects and write them to a RandomAccessFile, no need to store the objects after they are writen to the file. Hint use a loop to create and store the objects. Make sure a record size is determined for each grade.
2. Develop user interface that:
-Locates a grade record based on placement in the file, for example the user might want to see the 5th grade, or the 3rd grade.
-Prints a statement identifying the grade and its location such as "The fourth grade is for 85.4 and belongs to student 25".
-Ask the user if they wish to look up another grade or quit.
3. The program must catch and successfully handle (continue with out exiting)
4. NumberFormatException or InputMismatchException depending how you handle collection of the user input.
5. Any required checked exception.
===Class I have done====
public class Grade { byte StudentID; double grade; //Constructors public Grade() { this.StudentID = (byte)0; this.grade = 0.0; } public Grade(byte StudentID, double grade) { this.StudentID = StudentID; this.grade = grade; } //Mutators public void setStudentID(byte StudentID) { this.StudentID = StudentID; } public void setGrade(double grade) { this.grade = grade; } //Accessors public byte getStudentID() { return this.StudentID; } public double getGrade() { return this.grade; } }
*****I would appreciate the entirety of the RandomAccessDemo Classas all of this really confuses me. However, I think I might be able to do step 2 and below, so I really need step 1 if anything. ****
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
