Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Classes needed to answer question are provided below. Answer in java please. public interface GradeBooking{ void csvImport(String filename); void csvExport(String filename); void csvExport(String filename, Grade

Classes needed to answer question are provided below. Answer in java please.

image text in transcribed

image text in transcribed

public interface GradeBooking{

void csvImport(String filename); void csvExport(String filename); void csvExport(String filename, Grade grade); void addGrade(String firstName, String lastName, int pID, String grade); Grade ?ndGrade(String firstName, String lastName, int pID); void removeStudent(String firstName, String lastName, int pID); double findAverage(); };

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(); } }

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions