-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent_CSV_Writer.java
More file actions
35 lines (32 loc) · 1.25 KB
/
Student_CSV_Writer.java
File metadata and controls
35 lines (32 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import java.io.FileWriter;
import java.io.IOException;
import java.io.File;
import java.util.List;
//public class Student_CSV_Writer extends Student {
// Student_CSV_Writer(String netId, String fullName, int preGPA, List<String> pastCourses) {
// super(netId, fullName, preGPA, pastCourses);
// }
// void writeCSV(String fileName) {
// String filename = "Student.csv";
// try(FileWriter fw = new FileWriter(fileName, true)){ //set the append mode to true so that it won't override things
// boolean fileExists = new File(fileName).exists(); //checks if th e file already exists
// String fLine = "";
// if(!fileExists){
// fw.append("NetID,Full Name,GPA,Courses Taken\n");
// }
// else{
// fw.append(this.netId);
// fw.append(",");
// fw.append(this.name);
// fw.append(",");
// fw.append(Integer.toString(this.prevGPA));
// fw.append(String.join("|", this.pastCourses));
// fw.append("\n");
// }
//
// }
// catch(IOException e){
// System.out.println("Problem writing to file");
// }
// }
//}