Question: [Java] Please test your code in the link I provide before you post your answer. The output should be looked like exact same as the

[Java] Please test your code in the link I provide before you post your answer.

The output should be looked like exact same as the tester.

http://www.codecheck.it/files/1703312307312t8ksnyxnmuwb2vycnwwoos

[Java] Please test your code in the link I provide before you

Use the following files:

RosterTester.java

public class RosterTester { public static void main(String[] arg) { Roster myClass = new Roster(); System.out.println(myClass.getNames()); System.out.println("Expected: []"); myClass.remove("Thomas"); System.out.println(myClass.getNames()); System.out.println("Expected: []"); myClass.add(new Student("Carlos", 3.85)); myClass.add(new Student("Predeep", 3.55)); myClass.add(new Student("Aman", 3.5)); myClass.add(new Student("Amy", 3.95)); myClass.add(new Student("Yen", 3.5)); System.out.println(myClass.getNames()); System.out.println("Expected: [Aman, Amy, Carlos, Predeep, Yen]"); myClass.add(new Student("Predeep", 2.0)); myClass.add(new Student("James", 3.6)); System.out.println(myClass.getNames()); System.out.println("Expected: [Aman, Amy, Carlos, James, Predeep, Predeep, Yen]"); myClass.remove("Fred"); myClass.remove("Predeep"); System.out.println(myClass.getNames()); System.out.println("Expected: [Aman, Amy, Carlos, James, Predeep, Yen]"); } } 

Student.java

/** * Models a student in a class room * @author kathleenobrien * */ public class Student { private String name; private double gpa; /** * Constructs a Student with the given name and gpa * @param theName the name of the Student * @param thegpa the gpa of the Student */ public Student(String theName, double thegpa) { name = theName; gpa = thegpa; } /** * Gets the name of this Student * @return the name of this Student */ public String getName() { return name; } /** * Gets the gpa of this Student * @return the gpa of this Student */ public double getgpa() { return gpa; } @Override public String toString() { String s = "[" + getClass().getName() + ":" + "name="+ name + "," + "gpa=" + gpa + "]"; return s; } }

Write a class Roster that manages a LinkedList of student objects. The student objects are arranged alphabetically by name. You are given a student class. Do not modity it. The constructor for a Roster has no parameters but initializes an empty LinkedList of Students. The list is the instance variable. Provide these methods: add (Student s) adds the Student to the LinkedList. The Students are maintained in alphabetical order by name remove (string name) removes the first Student with the given name get Names returns an ArrayList of Strings containing the names of a the Students

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!