StudentList - import java.io.BufferedReader; i import...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.io.BufferedReader; import java.io.FileReader; i public class StudentList extends StudentsContainer { private StudentNode head; p public StudentList() { /* implement */ head = null; } public void makeList(String filename) { /* implement */ try { BufferedReader br = new BufferedReader(new FileReader(filename)); String line; S while ((line = br.readLine()) != null) { java.util.StringTokenizer st = new java.util.StringTokenizer( line, " \t"); l int ID = Integer.parseInt(st.nextToken()); String name = st.nextToken(); double score = Double.parseDouble(st.nextToken()); d insertStudent(ID, name, score); } br.close(); b } catch (java.io.FileNotFoundException e) { System.out.println("FileNotFoundException!"); } catch (java.io.IOException e) { System.out.println("IOException!"); } } public boolean deleteStudent(int ID) { /* implement */ StudentNode current = head; StudentNode before = null; S while (current != null) { if (current.getID() == ID) { if (current == head) { head = current.getlink();
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/09/2010 for the course CS CS101 taught by Professor Hwang during the Spring '10 term at 카이스트, 한국과학기술원.

Page1 / 3

StudentList - import java.io.BufferedReader; i import...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online