Re: Project5Read
import java.io.*;
public class Project5Write {
public static void main(String[] args) throws IOException {
BufferedReader stdin = new BufferedReader(new InputStreamReader
(System.in));
String fileName = new String();
System.out.println("Enter a name to save the file as: ");
fileName = stdin.readLine();
String quit = new String("quit");
File f = new File(fileName);
DataOutputStream ostream;
ostream = new DataOutputStream(new BufferedOutputStream(new
FileOutputStream(f)));
String empName = new String();
System.out.println("Enter an Employee Name or\tquit\tto end
program: ");
empName = stdin.readLine();
while (!empName.equalsIgnoreCase(quit)) {
String dept = new String();
System.out.println("Enter the Employee's Dept: ");
dept = stdin.readLine();
String vacationDays = new String();
System.out.println("Enter the number of Vacation Days: ");
vacationDays = stdin.readLine();
int numVacaDays;
numVacaDays = Integer.parseInt(vacationDays);
ostream.writeUTF(empName);
ostream.writeUTF(dept);
ostream.writeInt(numVacaDays);
System.out.println("Enter an Employee Name or\tquit\tto
end program: ");
empName = stdin.readLine();
}
ostream.close();
}
}