Git-Leon cfb4b4bed3 Update README.md 7 лет назад
src update 7 лет назад
.gitignore clean up project and gitignore 7 лет назад
.project first commit 7 лет назад
README.md Update README.md 7 лет назад
pom.xml Update pom.xml 7 лет назад

README.md

Student, Instructor, Classroom

Part 1.1 - Create Person Class

  • Create a Person class.
    • Person constructor should have a parameter of type String which sets the name instance-variable to the respective value.
    • The class should declare a final field named id of type long.
    • The class should define a getId() method which returns the Person object's id field.
    • The class should define a getName() method which returns the Person object's name field.
    • The class should define a setName() method which sets the Person object's name field.

-

Part 1.0 - Test Person

  • Create a TestPerson class.
    • Create a testSetName method which ensures that a Person object's name variable is being set by invoking the .setName method.
    • Create a testConstructor method which ensures that a Person object's name variable is being set by invoking the Person constructor.

-

Part 2.0 - Create Learner Interface

  • Create a Learner interface.
    • Learner should declare one method signature:
      • Method name: learn
      • Method parameters: double numberOfHours
      • Method return-type: void

-

Part 3.1 - Create Student Class

  • Create a Student class such that:
    • Student is a subclass of Person
    • Student implements the Learner interface
    • Student should have an instance variable totalStudyTime of type double
    • Student should have a concrete implementation of the learn method which increments the totalStudyTime variable by the specified numberOfHours argument.
    • Student should have a getTotalStudyTime() method which returns the totalStudyTime instance variable.

-

Part 3.0 - Test Student

  • Create a TestStudent class.
    • Create a testImplementation method that asserts that a Student is an instanceof a Learner.
    • Create a testInheritance method that asserts that a Student is an instanceof a Person.
    • Create a testLearn method that ensures a Student's totalStudyTime instance variable is incremented by the specified numberOfHours by invoking the .learn method.

-

Part 4.0 - Create Teacher Interface

  • Create a Teacher interface.

    • Teacher should declare a teach method signature:

      • Method name: teach
      • Method parameters:
        • Student student
        • double numberOfHours
      • Method return-type: void
    • Teacher should declare a lecture method signature:

      • Method name: lecture
      • Method parameters:
        • Student[] student
        • double numberOfHours
      • Method return-type: void

-

Part 5.1 - Create Instructor Class

  • Create an Instructor class such that:
    • Instructor is a subclass of Person
    • Instructor implements the Teacher interface
    • Instructor should have a concrete implementation of the teach method which invokes the learn method on the specified Student object.
    • Instructor should have a concrete implementation of the lecture method which invokes the learn method on each of the elements in the specified array of Student objects.
      • numberOfHours should be evenly split amongst the students.
        • double numberOfHoursPerStudent = numberOfHours / students.length;

-

Part 5.0 - Test Instructor

  • Create a TestInstructor class.
    • Create a testImplementation method that asserts that an Instructor is an instanceof a Teacher.
    • Create a testInheritance method that asserts that a Instructor is an instanceof a Person.
    • Create a testTeach method that ensures when an Instructor invokes the .teach method, a respective student's totalStudyTime instance variable is incremented.
    • Create a testLecture method that ensures when an Instructor invokes the .teach method, a respective student's totalStudyTime instance variable is incremented by the specified numberOfHours.

-

Part 6.1 - Create People class

  • Create a People class.
    • The class should instantiate an ArrayList field of Person objects named personList.
    • The class should define a method named add which adds a Person to the personList.
    • The class should define a method named findById which makes use of a long id parameter to return a Person object with the respective id field.
    • The class should define a method named remove which makes use of a Person person parameter to remove a respective Person object.
    • The class should define a method named remove which makes use of a long id parameter to remove a Person object with the respective id field.
    • The class should define a method named getArray which returns an array representation of the personList field.
    • The class should define a named removeAll which clears our personList field.

-

Part 6.0 - Test People

  • Create a TestPeople class.
    • Create a testAdd method which ensures that our personList in our People class populated with respective Student objects following invokation of the addStudent method.
    • Create a testRemove method which ensures that the personList in a People object is depopulated with a respective Person object following the invokation of the remove method.
    • Create a testFindById method which ensures that a respective Person object with a respective id field is returned upon invokation of the findById method on a respective People object.

-

Part 7.1 - Create MyCohort singleton

  • Note: The creation of this class will demonstrate an implementation of singleton design pattern.
  • Create a MyCohort class.
    • The class should be a subclass of the People class.
    • The class should statically instantiate a final field named INSTANCE of type MyCohort.
    • The class should define a private constructor which populates the INSTANCE field with respective Student representations of your colleagues.
      • Each student should have a unique id field.
    • The class should define a getInstance method which returns the INSTANCE field.

-

Part 7.0 - Test MyCohort singleton

  • Create a TestMyCohort class.
    • Create a test method which ensures that each of the students in your current cohort are in your MyCohort singleton.

-

Part 7.2 - Create ZipCodeInstructors singleton

  • Use Part 7.0 and Part 7.1 as a reference.
  • Create a ZipCodeInstructors singleton which represents the set of instructors at ZipCodeWilmington.
  • Create a TestZipCodeInstructors class.

-

Part 8.0 - Create ZipCodeWilmington Class

  • Create a ZipCodeWilmington class.
    • Statically instantiate a private ArrayList of Instructor objects named instructorList.
    • Create a public static method named hire which adds an Instructor to the instructorList and returns void.
    • Create a public static method named getInstructors which returns the instructorList.
    • Create a public static method named fireStaff which clears our instructorList.
    • Copy and paste this static initialization block immediately below your instructorList declaration.
static { // static initializer
	String[] instructorNames = { "Leon", "Tariq", "Froilan", "David", "Zach", "Iyasu" };
	for (String instructorName : instructorNames) {
		Instructor instructor = new Instructor(instructorName);
		hire(instructor);
	}
}

-

Part 6.0 - Test ZipCodeWilmington

  • Create a TestZipCodeWilmington class.

    • Create a method named setup which is annotated with @Before, takes has no parameters, and returns void.

      • Ensure this method invokes the .fireStaff method on ZipCodeWilmington
    • Create a testFireStaff method which ensures that our instructorList in our ZipCodeWilmington class isEmpty upon invokation.

    • Create a testHireStaff method which ensures that our instructorList is populated with respective Instructor objects.

-

Part 7.1 - Create Classroom Class

  • Create a TechConnect class.
    • The class should instantiate an ArrayList field of Student objects named studentList.
    • Create a public static method named recruitStudent which adds a Student to the studentList and returns void.
    • Create a public static method named getStudents which returns the studentList.
    • Create a public static method named removeStudents which clears our studentList.
    • Copy and paste this static initialization block immediately below your studentList declaration.
static { // static initializer
	String[] studentNames = { "Karen", "Liel", "Quinn", "Destiny", "Blesson", "Danielle B.", "Andre", "Jeff",
			"Carlo", "Julia D.", "Natalie", "Julia E.", "Shylee", "Genevieve", "Margo", "Whitney", "Rachel",
			"Bridget", "Seung", "Jessica", "Harry", "Kesler", "Darin", "Jade", "Dominika", "Nashae", "Brianna",
			"Laurent", "Rina", "Emily", "Elisha", "Caitlin", "Kierra", "Dana", "Alyssa", "Humaira", "Prajwal",
			"Cristine",  "Brendan" };
	for (String studentName : studentNames) {
		Student student = new Student(studentName);
		studentList.add(student);
	}
}

-

Part 7.0 - Test TechConnect

  • Create a TestTechConnect class.

    • Create a method named setup which is annotated with @Before, takes has no parameters, and returns void.

      • Ensure this method invokes the .removeStudents method on TechConnect
    • Create a testRemoveStudents method which ensures that our studentList in our TechConnect class isEmpty upon invokation.

    • Create a testRecruitStudent method which ensures that our studentList is populated with respective Student objects.

-

Part 8.1 - Create ClassRoom Class

  • Create a ClassRoom class.
    • Create a method named getRoster which returns a HashMapping of String to Person objects such that our ZipCodeWilmington instructors and TechConnect students' names map to their respective Person object.
    • Getting started hint below!
      • instantiate an ArrayList of Student objects named students by invoking the getStudents method on the TechConnect class.
      • instantiate an ArrayList of Instructor objects named instructors by invoking the getInstructor method on the ZipCodeWilmington class.

-

Part 8.0 - Test ClassRoom

  • Create a TestClassRoom class.
    • Assert that the HashMapping returned by getRoster, returns a valueSet containing each of the Person objects in ZipCodeWilmington's instructorList and TechConnect's studentList.