Question
Given the following Class: Create a separate test class with name HW04Q1 having the following: a) A static method toString that returns all the information
Given the following Class:
Create a separate test class with name HW04Q1 having the following: a) A static method toString that returns all the information about the student. b) A static method removeStudent that takes two arguments: string f1 representing a serial file name of Student objects as well as an int representing id of a student. The method should then delete that student from the file. c) A static method sort that takes a string f1 representing a serial file name of Student objects and sort the students on the file based on their GPA. You should use LinkedList data structure and create a new comparator file called GPAcomapator in order to compare the GPA between students using the API method Collections.sort. d) A static method countRecord that takes a string f1 representing a serial file name of Student objects and returns number of objects in that file. e) A static method getStudent that takes a string f1 representing a serial file name of Student objects and an int i and then return the ith student on that file. f) A static double method sumGPA that takes a string f1 representing a serial file name of Student objects and return sum of GPA for all students inside that file. g) A static method printFile that takes a string f1 representing a serial file name of Student objects and prints all students inside that file. h) A main method that creates a binary file with name student.ser of five Student objects. Then i. Print the file student.ser (using a call to printFile method). ii. Call method filterStudents that creates two files male.ser and female.ser from a string f1 representing a serial file name of Student objects based on the students gender. iii. Print files male.ser and female.ser (using two calls to printFile method). iv. Calculate GPA average for males and female (using methods countRecord and sumGPA).
(in java programing language) please help thanks
public class Student implements Serializable private int id; private String name; private int birthYear; private char gender; //valueoF private double gpa; Student(int id, String name, int birthYear, char gender, double gpa) ( this . id id; this.name -name; this.birthYear -birthYear; this.gender gender; this.gpa -gpa; public String getName() return name; ) public int getBitrhYear) return birthYear; ) public double getGPAC) return gpa; ) public char getGender() return gender; hStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started