Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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; h

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M Ricardo, Susan D Urban

3rd Edition

1284056945, 9781284056945

More Books

Students also viewed these Databases questions

Question

What must a creditor do to become a secured party?

Answered: 1 week ago

Question

When should the last word in a title be capitalized?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago