i know its alot and i appreaciate the help you are going to make several classes tha 5152340

I know its alot and i appreaciate the help!

you are going to make several classes that take advantage of two interfaces: FeeCalculator and Sortable. You will use the Sortable interface defined in the lab, as well as the Sort, Student, and Assignment6Tester classes I have provided. You will also need the MyDate class you have previously defined.

There are five main classes you will define: CanadianStudent, CanadianStudentUnder65, ForeignStudent, SeniorStudent, and University. You will also design a very simple interface, FeeCalculator. The Student class here is different from what you have made in the past. The tester class simply makes a University object, adds various students to the university, prints the array of students that the array has, sorts the array, and prints the array again.

Interface FeeCalculator:

This interface has one method called computeFees. It takes no arguments and returns a double.

Class University:

This class has an array of Student objects, a maximumNumberOfStudents integer, and an integer for the total number of students in the array. It has one constructor that accepts a maximum number of students for its array. It has a method called insertStudent that returns a boolean and accepts a Student as a parameter. This method adds a student to the array, at the first vacant index of the array. It has another method called numberOfStudents which returns an int and accepts a String, which is the name of a country. This method counts the number of Students from the given country and returns it. University also has a method called sortStudents which uses the Sort class to sort the array of Students. Finally, it has a toString method. The toString method returns “Number of students in university = ” followed by the number of students in the university. Each on a new line, it lists the toString of each student.

Class CanadianStudent:

This abstract class extends Student and has a constructor which accepts a String and an int, which are the student’s name and the number of courses taken, respectively. CanadianStudent overrides the method findCountry in Student, simply by returning “Canada”.

Class CanadianStudentUnder65:

This is a concrete class extending CanadianStudent. It has a constructor which accepts a String and an int, which are the student’s name and number of courses respectively. Another constructor only accepts the name, and sets the number of courses to 5. This class overrides computeFees (obtained from FeeCalculator in Student). For this type of student, if the student is taking at least 4 courses, the fee is $800. Otherwise, the fee is $200 per course. This type of student also overrides the lessThan method, obtained from Sortable in Student. The order for sorting is given below, and each concrete student must have a lessThan method that creates the order provided.

Class SeniorStudent:

This class extends CanadianStudent. This student has an instance variable called pension, which is a double. It has a single constructor, which accepts the student’s name, the number of courses taken, and the pension. The fee for a senior student is $50. This class overrides lessThan, again, which must enforce the order provided below. This class also overrides toString, by appending “, senior citizen who gets pension $” followed by its pension.

Class ForeignStudent:

This class has two instance variables: a String which is the country of origin, and a MyDate which is the date of entry to Canada of the student. ForeignStudent has a single constructor, which takes the name of the student, the number of courses taken, the country of origin, and the date of entry to Canada. The fee for a ForeignStudent is $1000 per course. Finally, ForeignStudent has a lessThan override, as well as an override for findCountry, which simply returns the country of origin of the student.

Sort Order:
-senior students come first, followed by foreign students, followed by Canadians that are not seniors

-within the senior students, sort alphabetically by name (ascending)

-within foreign students, sort alphabetically by name (ascending)

-within Canadian non-seniors, sort alphabetically by name (ascending)

-see the sample output below for more information

Sample Output:

Number of students in university = 9

Student #1, Name: John is from Canada, pays fees $800.0

Student #2, Name: Mary is from Canada, pays fees $600.0

Student #3, Name: Tom is from Canada, pays fees $50.0, senior citizen who gets pension $1500.0

Student #4, Name: Xiao is from China, pays fees $3000.0

Student #5, Name: Jagjit is from India, pays fees $5000.0

Student #6, Name: Liz is from Ireland, pays fees $3000.0

Student #7, Name: Hong is from China, pays fees $4000.0

Student #8, Name: Pat is from Canada, pays fees $50.0, senior citizen who gets pension $2000.0

Student #9, Name: Ting is from China, pays fees $5000.0

Number of students from Canada is 4

Number of students from China is 3

************* Now we will sort the students********************

Number of students in university = 9

Student #8, Name: Pat is from Canada, pays fees $50.0, senior citizen who gets pension $2000.0

Student #3, Name: Tom is from Canada, pays fees $50.0, senior citizen who gets pension $1500.0

Student #7, Name: Hong is from China, pays fees $4000.0

Student #5, Name: Jagjit is from India, pays fees $5000.0

Student #6, Name: Liz is from Ireland, pays fees $3000.0

Student #9, Name: Ting is from China, pays fees $5000.0

Student #4, Name: Xiao is from China, pays fees $3000.0

Student #1, Name: John is from Canada, pays fees $800.0

Student #2, Name: Mary is from Canada, pays fees $600.0

Classes

sortable:

public interface Sortable { public boolean lessThan(Sortable anObject); }

student:

public abstract class Student implements FeeCalculator, Sortable { private static int totalStudents = 0; private int studentNumber; protected int numberOfCoursesTaken; protected String studentName; public Student(String studentName, int numberOfCoursesTaken) { totalStudents++; this.studentNumber = totalStudents; this.studentName = studentName; this.numberOfCoursesTaken = numberOfCoursesTaken; } public abstract String findCountry(); public String toString() { return “Student #” + studentNumber + “, Name: ” + studentName + ” is from ” + findCountry() + “, pays fees $” + computeFees(); } }

"Get 15% discount on your first 3 orders with us"
Use the following coupon
FIRST15

Order Now