rendered paste body//Christopher Prashad
import java.util.*;
public class StudentTest
{
public static void main()
{
Queue<Student> list1 = new LinkedList<Student>();
Queue<Student> list2 = new LinkedList<Student>();
Student one = new Student("Rick",89.3);
Student two = new Student("Matt",34.9);
Student three = new Student("Carson",99.0);
list1.add(one);
list1.add(two);
list1.add(three);
list2=cutAtGPA(list1,85.0);
while(!list2.isEmpty())
{
Student a = list2.remove();
System.out.println("name: " + a.getName() + " grade: " + a.getGPA());
}
}
public static Queue<Student> cutAtGPA(Queue<Student> students, double minGPA)
{
Student temp = new Student();
Queue<Student> finallist = new LinkedList<Student>();
while(!students.isEmpty())
{
Student arg = students.remove();
if(arg.getGPA() >= minGPA)
finallist.add(arg);
}
return finallist;
}
}
//Christopher Prashad
public class Student
{
private String name;
private double GPA;
public Student()
{
name = null;
GPA = 0.0;
}
public Student(String n, double grade)
{
name = n;
GPA = grade;
}
public double getGPA()
{
return GPA;
}
public String getName()
{
return name;
}
}