Giter Club home page Giter Club logo

cpe200-week4-hw's Introduction

Week 4 - Homework: Course Enrollment

This homework will help you learn how to solve problem with multiple Java classes.

The objectives of this week are following:

  • Programming abstraction of simple enrollment system.
  • Learn more about class composition relationship.
  • Reusing PList and PNode classes with other types of data.
  • Using constructor to initialized class data type.
  • Using "this" keyword as parameter.

##PNode Class

  • Modify the PNode class from your previous work to store "Object" data instead of "char".

##PList Class

  • Modify the PList class from your previous work to be able to handle "Object" data instead of "char".
  • Make sure all the methods work correctly with "Object".
  • Rename the method "search(char i)" to "found(Object data)" which search the list for the specified data
    • Return True if the data is found in the list, otherwise returns False.
  • Add the "remove(Object data)" which removes the first node containing the "data" from the list.
    • Returns True if data is removed successfully, otherwise returns False.
  • Add the "elementAt(int index)" which returns an "Object" data stored at location "index".
    • "index" value of a list starts from 0 to (size-1)
    • Returns "null" if "i" is invalid.

##Student Class From your previous work:

  • Add a list of courses that a student has enrolled successfully. Implement using "PList".

Methods:

  • Modify constructors so that they can initialized the "courses" attribute properly.
  • Add the "addCourse(Course c)" method to add a course that a student wants to enroll.
  • Add the "dropCourse(Course c)" method to drop a course that a student wants to drop.
  • Modify the "toString()" method : for printing the student object's state:
    • Also printing "course id" and "course name" of all courses that a student has enrolled.

##Course Class From your previous work:

  • Modify the default maximum number of students to 3 (instead of 10).
  • Add a list of students that has already enrolled in this course. Implement using "Plist".

Methods:

  • Modify constructors so that they can initialized the "students" attribute properly.
  • Add the "enrollStudent(Student s)" method to add a student to a course.
    • Need to check if the course is FULL or not?
    • Need to check if the student is ALREADY ENROLLED to the course or not?
    • Return TRUE, if the student is enrolled successfully.
    • Otherwise, print error message, and return FALSE.
  • Add the "removeStudent(Student s)" method to remove a student from a course.
    • Need to check if the course has NO STUDENT or not?
    • Need to check if the student is ALREADY ENROLLED to the course or not?
    • Return TRUE, if the student is removed successfully.
    • Otherwise, print error message, and return FALSE.
  • Modify the "toString()" method : for printing the course object's state:
    • Also printing "student id" and "student name" of all students who are studying this course.

To complete the homework you need to meet following requirements:

  • Pass all unit tests: PListTest.java, StudentTest.java, CourseTest.java
  • Output from the "TestEnrollment.java" program should be the same as or very similar to the output stored in the "TestEnrollment-output.txt".
  • Draw a class diagram showing the relationship among the classes: PNode, PList, Student, and Course

cpe200-week4-hw's People

Contributors

potikanond avatar dpotikan avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.