Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.44 KB | None | 0 0
  1. package bookKeeping;
  2.  
  3. import java.util.GregorianCalendar;
  4. import java.text.SimpleDateFormat;
  5. import java.text.ParseException;
  6. import java.util.Calendar;
  7. import java.util.Scanner;
  8. import java.util.Date;
  9.  
  10. final class Majors {
  11. public static String[] majors = null;
  12. }
  13.  
  14. public final class Student {
  15. private static String fName;
  16. private static String mName;
  17. private static String lName;
  18. private static String classYear;
  19. private static String major;
  20. private static String ID;
  21.  
  22. public Student() {
  23. this.fName = "First_Name";
  24. this.mName = "";
  25. this.lName = "Last_Name";
  26. this.classYear = "00/0000";
  27. this.major = "Undefined";
  28. this.ID = "0000-0000";
  29. }
  30.  
  31. public static String ToString() {
  32. }
  33.  
  34. public static String SetNames(String name) {
  35. }
  36.  
  37. public static String SetID(String id) {
  38. }
  39.  
  40. public static String SetMajor(String m) {
  41. }
  42.  
  43. public static String SetClassYear(String date) {
  44. }
  45. }
  46.  
  47. package bookKeeping;
  48.  
  49. import bookKeeping.Student;
  50.  
  51. import java.io.File;
  52. import java.io.FileReader;
  53. import java.io.FileWriter;
  54. import java.io.IOException;
  55. import java.io.BufferedReader;
  56. import java.io.BufferedWriter;
  57. import java.io.FileNotFoundException;
  58.  
  59. class Construct {
  60. public static String[] names(String fileName) {
  61. String[] studentInfo = null;
  62. Student[] studentNames = null;
  63. BufferedReader reader = null;
  64.  
  65. int a = 0, position = 0, lineSafe = 0;
  66. try {
  67. String line;
  68. reader = new BufferedReader(new FileReader(new File(fileName)));
  69. System.out.println("nThis program assumes MM/dd/YYYY and MM/YYYY");
  70.  
  71. line = reader.readLine();
  72.  
  73. a = Integer.parseInt(line);
  74. studentInfo = new String[a];
  75. studentNames = new Student[a];
  76.  
  77. Student[lineSafe] = new Student();
  78.  
  79. while ((line = reader.readLine()) != null) {
  80. String kappa = null;
  81. switch (position) {
  82. case 0: kappa = Student[lineSafe].SetNames(line);
  83. break;
  84. case 1: kappa = Student[lineSafe].SetID(line);
  85. break;
  86. case 2: kappa = Student[lineSafe].SetMajor(line);
  87. break;
  88. case 3: kappa = Student[lineSafe].SetClassYear(line);
  89. break;
  90. }
  91.  
  92. if (kappa != null) {
  93. System.out.println(kappa);
  94. System.exit(0);
  95. }
  96.  
  97. if (position == 3) {
  98. position = 0;
  99. studentInfo[lineSafe] = Student[lineSafe].ToString();
  100. Student[++lineSafe] = new Student();
  101. } else {
  102. position++;
  103. }
  104. }
  105.  
  106. } catch (IOException e1) {
  107. System.out.println("nIOEXCEPTIONn");
  108. System.exit(0);
  109. } finally {
  110. try {
  111. reader.close();
  112. } catch (IOException e2) {
  113. e2.printStackTrace();
  114. }
  115. }
  116.  
  117. return studentInfo;
  118. }
  119. }
  120.  
  121. public class Advisor {
  122. public static void main(String[] args) {
  123. if (args.length != 1) {
  124. System.out.println("nError: Files missing from Command Linen");
  125. System.exit(0);
  126. }
  127.  
  128. String[] studentInfo = Construct.names(args[0]);
  129. }
  130. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement