Java Homework
Question Description
import java.io.File;
import java.io.FileNotFoundException;
import java.util.*;
public class Main
{
public static void main(String[] args)
{
// TODO: make ArrayList of Double
// TODO: make LinkedList of Student
// TODO: call method to load constants, and returns ArrayList of Double
// TODO: call method to load students, and returns LinkedList of Student
// TODO: call printStuff method on constants
// TODO: call printStuff method on Students
// TODO: sort Students with Collections.sort()
// TODO: call printStuff method on Students
// TODO: call trimStudents() method
// TODO: call printStuff method on Students
}
// TODO: create a method loadConstants() and returns ArrayList of Doubles
// TODO: uncomment this
/*
private static LinkedList<Student> loadStudents()
{
File file = new File("res/roster.csv");
Scanner reader;
try
{
reader = new Scanner(file);
}
catch (FileNotFoundException e)
{
System.err.println("Could not find file: " + file.toPath());
return null;
}
LinkedList<Student> students = new LinkedList<Student>();
reader.nextLine(); // eat header
while (reader.hasNext())
{
String line = reader.nextLine();
StringTokenizer tokenizer = new StringTokenizer(line, ",n");
String last = tokenizer.nextToken();
String first = tokenizer.nextToken();
float grade = Float.valueOf(tokenizer.nextToken());
Student s = new Student(first, last, grade);
students.add(s);
}
return students;
}
*/
// TODO: create a printStuff() method that takes a List of anything and prints it
// TODO: create a trimStudents() method that takes a LinkedList of Students
// and a double for the amount, which iterates through the LinkedList with and
// Iterator and removes any Student with a grade < 90
}
Complete the comments and explain to me please
Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."