Guest User

Untitled

a guest
Dec 20th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.05 KB | None | 0 0
  1. import java.util.Arrays;
  2.  
  3. public class Students
  4. {
  5. private int studentID;
  6. private String firstName;
  7. private String lastName;
  8. private String email;
  9. private int age;
  10. private int[] grades;
  11.  
  12. public Students(int inputID, String inputFirst, String inputLast, String inputEmail, int inputAge, int[] inputGrades) //Constructor
  13. {
  14. studentID = inputID;
  15. firstName = inputFirst;
  16. lastName = inputLast;
  17. email = inputEmail;
  18. age = inputAge;
  19. grades = inputGrades;
  20. }
  21.  
  22.  
  23. public int getStudentID()
  24. {return studentID;}
  25.  
  26. public String getFirstName()
  27. {return firstName;}
  28.  
  29. public String getLastName()
  30. {return lastName;}
  31.  
  32. public String getEmail()
  33. {return email;}
  34.  
  35. public int getAge()
  36. {return age;}
  37.  
  38. public int[] getGrades()
  39. {return grades;}
  40.  
  41.  
  42.  
  43. public void setStudentID(int inputID)
  44. {
  45. studentID = inputID;
  46. }
  47.  
  48. public void setFirstName(String inputFirst)
  49. {
  50. firstName = inputFirst;
  51. }
  52.  
  53. public void setLastName(String inputLast)
  54. {
  55. lastName = inputLast;
  56. }
  57.  
  58. public void setEmail(String inputEmail)
  59. {
  60. email = inputEmail;
  61. }
  62.  
  63. public void setAge(int inputAge)
  64. {
  65. age = inputAge;
  66. }
  67.  
  68. public void setGrades(int[] inputGrades)
  69. {
  70. grades = inputGrades;
  71. }
  72.  
  73.  
  74.  
  75.  
  76. public void printStudentID()
  77. {
  78. System.out.print(studentID);
  79. }
  80.  
  81. public void printFirstName()
  82. {
  83. System.out.print(firstName);
  84. }
  85.  
  86. public void printLastName()
  87. {
  88. System.out.print(lastName);
  89. }
  90.  
  91. public void printEmail()
  92. {
  93. System.out.print(email);
  94. }
  95.  
  96. public void printAge()
  97. {
  98. System.out.print(age);
  99. }
  100.  
  101. public void printGrades()
  102. {
  103. System.out.print(grades);
  104. }
  105.  
  106.  
  107. public static void main(String[] args)
  108. {
  109.  
  110.  
  111. String [] students =
  112. {
  113. "1,John,Smith,Johnl989@gmail.com,20,88,79,59",
  114. "2,Suzan,Erickson,Erickson_l990@gmailcom,19,91,72,85",
  115. "3,Jack,Napoli,The_lawyer99yahoo.com,19,85,84,87",
  116. "4,Erin,Black,Erin . black@comcast.net,22,91,98,82",
  117. "5,Jason,Wood,jwoo163@wgu.edu,30,99,98,97"
  118. };
  119.  
  120. //int [] testArray ={20,88,79,59};
  121. //Students john = new Students(1,"John","Smith","Johnl989@gmail.com",20,testArray);
  122. //System.out.println(Arrays.toString(john.getGrades()));
  123. //String student = "1,John,Smith,Johnl989@gmail.com,20,88,79,59";
  124.  
  125.  
  126.  
  127.  
  128. for (int i = 0; i < students.length; i++)
  129. {
  130. String student = students[i];
  131.  
  132. String delims = "[,]";
  133. String[] values = student.split(delims);
  134.  
  135.  
  136. }
  137. }
  138. }
  139.  
  140. /*
  141. String [] students=
  142. {
  143. "1,John,Smith,Johnl989@gmail.com,20,88,79,59",
  144. "2,Suzan,Erickson,Erickson_l990@gmailcom,19,91,72,85",
  145. "3,Jack,Napoli,The_lawyer99yahoo.com,19,85,84,87",
  146. "4,Erin,Black,Erin . black@comcast.net,22,91,98,82",
  147. "5,Jason,Wood,jwoo163@wgu.edu,30,99,98,97"
  148. };
  149.  
  150.  
  151.  
  152. * Include the following instance variables that describe each student:
  153.  
  154. • student ID
  155. • first name
  156. • last name
  157. • e-mail address
  158. • age
  159. • array of grades
  160.  
  161.  
  162.  
  163.  
  164. Create Get and Set for student variables
  165.  
  166.  
  167.  
  168. */
Add Comment
Please, Sign In to add comment