Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Arrays;
- public class Students
- {
- private int studentID;
- private String firstName;
- private String lastName;
- private String email;
- private int age;
- private int[] grades;
- public Students(int inputID, String inputFirst, String inputLast, String inputEmail, int inputAge, int[] inputGrades) //Constructor
- {
- studentID = inputID;
- firstName = inputFirst;
- lastName = inputLast;
- email = inputEmail;
- age = inputAge;
- grades = inputGrades;
- }
- public int getStudentID()
- {return studentID;}
- public String getFirstName()
- {return firstName;}
- public String getLastName()
- {return lastName;}
- public String getEmail()
- {return email;}
- public int getAge()
- {return age;}
- public int[] getGrades()
- {return grades;}
- public void setStudentID(int inputID)
- {
- studentID = inputID;
- }
- public void setFirstName(String inputFirst)
- {
- firstName = inputFirst;
- }
- public void setLastName(String inputLast)
- {
- lastName = inputLast;
- }
- public void setEmail(String inputEmail)
- {
- email = inputEmail;
- }
- public void setAge(int inputAge)
- {
- age = inputAge;
- }
- public void setGrades(int[] inputGrades)
- {
- grades = inputGrades;
- }
- public void printStudentID()
- {
- System.out.print(studentID);
- }
- public void printFirstName()
- {
- System.out.print(firstName);
- }
- public void printLastName()
- {
- System.out.print(lastName);
- }
- public void printEmail()
- {
- System.out.print(email);
- }
- public void printAge()
- {
- System.out.print(age);
- }
- public void printGrades()
- {
- System.out.print(grades);
- }
- public static void main(String[] args)
- {
- String [] students =
- {
- "1,John,Smith,Johnl989@gmail.com,20,88,79,59",
- "2,Suzan,Erickson,Erickson_l990@gmailcom,19,91,72,85",
- "3,Jack,Napoli,The_lawyer99yahoo.com,19,85,84,87",
- "4,Erin,Black,Erin . black@comcast.net,22,91,98,82",
- "5,Jason,Wood,jwoo163@wgu.edu,30,99,98,97"
- };
- //int [] testArray ={20,88,79,59};
- //Students john = new Students(1,"John","Smith","Johnl989@gmail.com",20,testArray);
- //System.out.println(Arrays.toString(john.getGrades()));
- //String student = "1,John,Smith,Johnl989@gmail.com,20,88,79,59";
- for (int i = 0; i < students.length; i++)
- {
- String student = students[i];
- String delims = "[,]";
- String[] values = student.split(delims);
- }
- }
- }
- /*
- String [] students=
- {
- "1,John,Smith,Johnl989@gmail.com,20,88,79,59",
- "2,Suzan,Erickson,Erickson_l990@gmailcom,19,91,72,85",
- "3,Jack,Napoli,The_lawyer99yahoo.com,19,85,84,87",
- "4,Erin,Black,Erin . black@comcast.net,22,91,98,82",
- "5,Jason,Wood,jwoo163@wgu.edu,30,99,98,97"
- };
- * Include the following instance variables that describe each student:
- • student ID
- • first name
- • last name
- • e-mail address
- • age
- • array of grades
- Create Get and Set for student variables
- */
Add Comment
Please, Sign In to add comment