CMIS 345
University of Maryland - European Division
Term 4 - 14 April - 22 June 2008
Distance Education
Lecturer: Jerry Rugg
Object Oriented Design and Programming
Lab 3 - Employees
Due 30 May 2008
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Reading Assignment - Chapters 6 - 7
- Chapter 6: Inheritcance and Abstract Classes - the concept of inetrfaces and class hierarchies is crucial to Obecjt-Oriented Analysis and Design. This chapter is the basis for not only this programming assignment but one of the most important chapters in the whole course.
- Chapter 7: The Java Object Model - many important concepts related to how type plays into what actions or oeprations can and cannot be performed on any given instance or class variable. We will emphasize the concepts of cloning (copying) and serialization for this programming assignment.
Assignment Grading
The Assignment Grading policy letter details how I will grade this assignment. The Assignment Grading policy, along with all pertinent programming assignment policies, can be found in the Course Content section of our WebTycho classroom and also on the alternate CMIS 345 Course Home Page. In particular the Naming Conventions, Comments in Code, and Error Handling policies would be worth reading. It would also be beneficial to read through the Assignment Requirements policy letter.
This lab assignment is worth 15% of your final grade. However, based on class results, I reserve the right to change the percentage contribution at the end of the course. One-half, 50%, of the grade will come from the documentation required below and one-quarter, 25%, from the implementation code and one-quarter, 25%, from the testing code.
Remember, this assignment is due NLT Friday, 30 May 2008.
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Assignment Background
This course is about design, specifcially object-oriented design. The course is not about introducing you to new or advanced features of the Java programming language and as such it is really not about Java programming. Granted you will be given opportunities to demonstrate your grasp of object-oriented design using the Java programming language but just writing a Java program that compiles and executes is only half of the grade. The other half is in your design, how you dcoument your design and how you design and implement your tests to prove to me and yourself your design is good.
Assignment Requirements
Design and implement an Employee class library and a GUI based test application with the following minimal functionality:
Using the Employee class from Chapter 6 and Exercise 6.2 as a starting point, the Employee library minimum requirements are:
- Design an interface named IEmpoyee that contains the pertinent methods of the Employee class definition on page 216 plus a getEmployeeID (this will be a 'read-only' or restricted accessor because an employee's ID can never change.
- Design an abstract base class named AbstractEmployee that implements the necessary contructors and getName, setSalary and getSalary methods must still declares the class abstract. You will also override the hashCode, equals and clone methods to provide meaningful implementations (see section 7.3).
- Design a class named HourlyEmployee as described in Exercise 6.2. Note: The getWeeklySalary method must be added to the interface and abstract base class also. You will also override the toString method to provide a meaningful implementation.
- Design a class named SalariedEmployee as described in Exercise 6.2. Note: The getWeeklySalary method must be added to the interface and abstract base class also. You will also override the toString method to provide a meaningful implementation.
- Design a class named EmployeeList that holds a collection of IEmployee objects and provides the following methods:
- boolean addEmployee(IEmployee newEmployee) - if the given employee is not already in the list, add this employee and return true, else return false and do not add the employee to the list.
- IEmployee removeEmployee(IEmployee oldEmployee) - if the old employee is found in the list, remove the old employee from the list and return it, else return null.
- void saveList() - this should serialize the EmployeeList to a file named employees.dat in the current working directory (see section 7.5).
- void loadList() - this should de-serialize the EmployeeList from the file named employees.dat in the current working directory (see section 7.5).
- string toString() - override to dump the entire list to a string using the StringBuffer or StringBuilder class.
GUI Tester minimum requirements:
- Design, implement and document a simple GUI based test application name EmployeeTest to test the HourlyEmployee, SalariedEmployee and EmployeeList classes. As a minimum you will need labeled controls (meaning a label for each control explaining what the control's purpose) for:
- Inputting the necessary name, salary, ID, etc., to create salaried or hourly employee
- Buttons for the following:
- Create - create the desired IEmployee instance and add it to an instance of the EmployeeList. This should fail if the emloyee is already in the list.
- Remove - remove the desired IEmployee from the list. This should fail if the employee is not in the list.
- Clone - this will make a deep copy of the employee and output to the Text output area.
- Save List - calls the saveList method of the EmployeeList.
- Load List - calls the loadList method of the EmployeeList.
- Text output area where you will output the results of your operations using well formatted messages and / or the toString method. Note: as part of the testing, adding the same employee to the list mulitple times should result in the employee not being added and your output into the text output area should confirm this fact. The same is true for trying to remove a non-existent employee from the list, etc.
Additional requirements:
- As part of your documentation, ensure you explain all the design concepts you used in your design and implementation. Remember you class level block comments must 'tell the story of your work'.
Minimum general design requirements:
- Demonstrate you have read and understand the concepts in Chapter 2 by documenting the your classes and interfaces using the CRC concept. Think this through,how do you expect your class or interface to be used and how have you implemented the class. Add this documentation to the class level Javadoc comment.
- Document the classes / interfaces and each method and variable using Javadoc style commenting. For each method, which is essentially your public interface, your documentation should include your interface analysis as described in section 3.5. Some attributes will of course be more involved than others but none the less you are to address each of them.
- Because I will be automating the testing of your assignments, it is imperative you follow the class naming that is prescribed.
- You will follow the Java naming conventions, i.e., class names are in Pascal case; methods and variables are in Camel case.
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Turn-in Assignment
Instructions - individually post your answers to this assignment in the Assignments Section of the WebTycho classroom. To facilitate easier downloading and grading, please zip all programming and related files (*.java, *.html, etc) and any project files into one file and upload the zipped file using the naming convention lastname_lab#. For example, for this assignment the name would be snuffy_lab3.zip. Do not include any .class or .jar files as I will be compiling your source code as part of my testing.
Reading Assignment | Assignment Requirements |
Assignment Turn-in | Assignment Conference
Conference
I posted a new conference called Lab 3 and I would like you all to freely comment and ask questions pertaining to the chapters covered during this time frame and the assignment. There is a wide range of expertise in the class so here is your chance to learn from each other. Be considerate but do not be afraid to ask or offer an answer. I expect each of you to participate but this not a test but rather a classroom discussion.