Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer must be in java and the classes needed to complete the question is provided down below. The majority of the picture just explains what

Answer must be in java and the classes needed to complete the question is provided down below. The majority of the picture just explains what the methods in the class GradeBooking do, the question is not as long as it looks. I will upvote, thank you.

image text in transcribed

image text in transcribed

public interface GradeBooking{

void csvImport(String ?lename); void csvExport(String ?lename); void csvExport(String ?lename, Grade grade); void addGrade(String ?rstName, String lastName, int pID, String grade); Grade ?ndGrade(String ?rstName, String lastName, int pID); void removeStudent(String ?rstName, String lastName, int pID); double ?ndAverage(); };

public class Grade{ private String letter; public Grade(String grade){ letter=grade; } public String getLetter(){return letter;} public double getValue(){ switch(letter){ case "A": return 4; case "A-": return 3.667; case "B+": return 3.333; case "B": return 3; case "B-": return 2.667; case "C+": return 2.333; case "C": return 2; case "C-": return 1.667; case "F": return 0; } return 0; } }

public class Student implements Comparable{ private String firstName; private String lastName; private int pID; public Student(String aFirst, String aLast, int apID){ firstName = aFirst; lastName = aLast; pID = apID; } public int getID(){return pID;} public String getFirst(){return firstName;} public String getLast(){return lastName;} public int compareTo(Object s){ if (lastName.compareTo(((Student)s).getLast())!=0) return lastName.compareTo(((Student)s).getLast()); else if (firstName.compareTo(((Student)s).getFirst())!=0) return firstName.compareTo(((Student)s).getFirst()); else return pID-((Student)s).getID(); } }

public class Student1 extends Student{ public static final int HASH_MULTIPLIER=29; public Student1(String aFirst, String aLast, int apID){ super(aFirst, aLast,apID); } public int hashCode(){ return (int) Math.pow(HASH_MULTIPLIER,2)*getFirst().hashCode()+HASH_MULTIPLIER*getLast().hashCode()+new Integer(getID()).hashCode(); } }

public class Student2 extends Student{ public static final int HASH_MULTIPLIER=37; public Student2(String aFirst, String aLast, int apID){ super(aFirst, aLast,apID); } public int hashCode(){ return (int) Math.pow(HASH_MULTIPLIER,2)*getFirst().hashCode()+HASH_MULTIPLIER*getLast().hashCode()+new Integer(getID()).hashCode(); } }

In this assignment, you are asked to write classos HashGradeBook and TreeGradeBook that implement the following interface named GradeBooking. publie interface Grade Bookingf void csvimport(String filename); void csvExport (String filename) void csvExport (String filename, Grade grade); void addGrade(String first Name, String last Name, int pID, String grade); Grade findGrade(String first Name, String lastName, int pID); void removeStudent (String first.Name, String last Name, int pID); double findAverage0: Description of each method can be found below: , noid csulmport(String filename): gets a file name as its only input parameter, reads its content and stores it in a map data structure (java.util.Hash Map( Student, Grade) in HashGradelkok class and Java util. The Map(Student, Grude> in TreeGrdeBook class). The Java code of classes of Student and Grade are available on moodle. In the input esv file, every line contains the first name, last name, PID, and grade of Alex, Foster, 12345, A Amanda, Taylor, 12398, A . void esvExport(String filename): Transfers the students info from the map data struc- a student separated by comma. Here is an example of input file format: Joe, Miles, 98765, B+ ture back to the CSV file specified by its input parameter. The output file format is the same as the input file format used by the previous method. e void csvErport(String filename, Grude grade): Writes the information of students with the given grade to the CSV file specified by the first input parameter

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

Introductory Relational Database Design For Business With Microsoft Access

Authors: Jonathan Eckstein, Bonnie R. Schultz

1st Edition

1119329418, 978-1119329411

More Books

Students also viewed these Databases questions

Question

3. Define cultural adaptation.

Answered: 1 week ago

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

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