Advertisement
WadeRollins2710

Student

Sep 10th, 2019
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.68 KB | None | 0 0
  1. public class Solution {
  2.     public static class Student {
  3.         private String name;
  4.         private String id;
  5.         private String group;
  6.         private String email;
  7.  
  8.         Student() {
  9.             this.name = "Student";
  10.             this.id = "000";
  11.             this.group = "K62CB";
  12.             this.email = "uet@vnu.edu.vn";
  13.         }
  14.  
  15.         Student(String initName, String initID, String initEmail) {
  16.             this.name = initName;
  17.             this.id = initID;
  18.             this.group = "K62CB";
  19.             this.email = initEmail;
  20.         }
  21.  
  22.         Student(Student s) {
  23.             this.name = s.name;
  24.             this.id = s.id;
  25.             this.group = s.group;
  26.             this.email = s.email;
  27.         }
  28.  
  29.         Student(String initName, String initID, String initGroup, String initEmail) {
  30.             this.name = initName;
  31.             this.id = initID;
  32.             this.group = initGroup;
  33.             this.email = initEmail;
  34.         }
  35.  
  36.         public String getName() {
  37.             return this.name;
  38.         }
  39.  
  40.         public void setName(String nameValue) {
  41.             this.name = nameValue;
  42.         }
  43.  
  44.         public String getInfo() {
  45.             return this.name + " - " + this.id + " - " + this.group + " - " + this.email;
  46.         }
  47.     }
  48.  
  49.     public static class StudentManagement {
  50.         private Student[] students;
  51.         private int student_count;
  52.  
  53.         StudentManagement() {
  54.             this.students = new Student[100];
  55.             student_count = 0;
  56.         }
  57.  
  58.         public static Boolean sameGroup(Student s1, Student s2) {
  59.             return s1.group == s2.group;
  60.         }
  61.  
  62.         public void addStudent(Student newStudent) {
  63.             if (this.student_count < 100) {
  64.                 students[student_count] = new Student(newStudent.name, newStudent.id, newStudent.group, newStudent.email);
  65.                 student_count++;
  66.             }
  67.         }
  68.  
  69.         public String studentByGroup() {
  70.             Boolean[] checked = new Boolean[student_count];
  71.             for (int i = 0; i < student_count; i++)
  72.                 checked[i] = false;
  73.         }
  74.  
  75.         public void removeStudent(String findid) {
  76.             int index = 0;
  77.             for (int i = 0; i < student_count; i++)
  78.                 if (this.students[i].id == findid) {
  79.                     for (int k = 0; i < student_count; i++)
  80.                         students[i] = students[i + 1];
  81.                     student_count--;
  82.                 }
  83.         }
  84.     }
  85.  
  86.     public static void main(String[] args) {
  87.         Student studentAn = new Student("Nguyen Van An", "17020001", "k62CC", "17020001@vnu.edu.vn");
  88.         int[] a = new int[100];
  89.     }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement