Assignment title: Information
ITECH1000/5000 Programming 1
Assignment 2
Overview
While the first assignment focused primarily on declarative programming using control structures, this
assignment will require you to demonstrate your object-oriented programming skills by creating a program
involving multiple classes. It draws on the material covered in Weeks 1-10 of the course.
The assignment task consists of implementing a tool which would assist the manager of a small company in
scheduling employees. The Appendix at the back of this document provides a sample screenshot showing a
working solution to the assignment as a guide to how it should function.
Timelines and Expectations
Percentage Value of Task: 20%
Due: 4pm Friday of Week 11 – refer to your course description for the date
Minimum time expectation: 20 hours
Learning Outcomes Assessed
The following course learning outcomes are assessed by completing this assessment:
• K1. identify and use the correct syntax of a common programming language;
• K2. recall and use typical programming constructs to design and implement simple software
solutions;
• K3. reproduce and adapt commonly used basic algorithms;
• K4. explain the importance of programming style concepts (documentation, mnemonic names,
indentation);
• S1. utilise pseudocode and/or algorithms as a major program design technique;
• S2. write and implement a solution algorithm using basic programming constructs;
• S3. demonstrate debugging and testing skills whilst writing code;
• S4. describe program functionality based on analysis of given program code
• A1. develop self-reliance and judgement in adapting algorithms to diverse contexts;
• A2. design and write program solutions to identified problems using accepted design
constructs
CRICOS Provider No. 00103D Page 1 of 15
Assessment Details
The assignment task consists of implementing a tool which would assist the manager of a small company in
scheduling employees. The details of the company's operations are as follows:
• It operates on 5 days of the week (not on the weekends). On each day the company runs four shifts,
and a single employee is required for each shift.
• The company employs both permanent employees and casual employees.
• Permanent employees are allocated to the same shift for all 5 days of a week, and are paid a fixed
weekly wage.
• Casual employees can be allocated to any number of shifts per week (including zero), and are paid a
fixed amount per shift worked.
The Employee Class
The first stage in this assignment is to define a Java class for an Employee based on the UML diagram on the
next page. The methods of Employee should perform as follows:
- The constructor simply initialises the instance variables to the values provided as parameters, and sets
shiftsWorkedThisWeek to 0
- The accessor methods (gets) simply return the value of their corresponding variable
- There are no set methods – it is assumed that the employee's name and ID will not change
- resetShiftsWorkedThisWeek() sets shiftsWorkedThisWeek to 0
- incrementShiftsWorkedThisWeek () adds one on to the current value of shiftsWorkedThisWeek
- calculateWeeklyPay() is provided so that it can be over-ridden by the subclasses – this method can be
declared as abstract
- the toString method returns a String describing the Employee
o this should be formatted as their employee ID in square brackets, followed by their last name in
all upper-case, a comma, and their first-name in mixed-case
o for example, if we have instantiated an Employee as follows
Employee e = new Employee("Joe","Bloggs","BLO12345678");
then calling e.toString should return the String "[BLO12345678] BLOGGS, Joe"
You should also write a small driver class called TestEmployee, and thoroughly test the Employee class
before proceeding further.
CRICOS Provider No. 00103D Page 2 of 15
Employee
- String firstName;
- String lastName;
- String ID;
- int shiftsWorkedThisWeek;
~ Employee(firstName:String; lastName:String; ID:String)
+ getFirstName(): String
+ getLastName(): String
+ getID(): String
+ getShiftsWorkedThisWeek()
+ resetShiftsWorkedThisWeek()
+ incrementShiftsWorkedThisWeek()
+ calculateWeeklyPay():double
+ toString():String
Figure 1: UML Diagram for the class Employee
The PermanentEmployee and CasualEmployee classes
You will also need to create two subclasses of Employee called PermanentEmployee and CasualEmployee.
These will inherit from and extend the Employee class as shown in the following UML diagram (refer to Week
10's material on inheritance to see how to implement this):
PermanentEmployee (extends Employee)
- weeklyWage: double
~ PermanentEmployee(firstName:String; lastName:String; ID:String)
~ PermanentEmployee(firstName:String; lastName:String; ID:String; weeklyWage: double)
+ setWeeklyWage(weeklyWage: double)
+ getWeeklyWage(): double
+ calculateWeeklyPay():double
Figure 2: UML Diagram for the class PermanentEmployee
CRICOS Provider No. 00103D Page 3 of 15
CasualEmployee (extends Employee)
- shiftRate: double
~ CasualEmployee(firstName:String; lastName:String; ID:String)
~ CasualEmployee(firstName:String; lastName:String; ID:String; shiftRate: double)
+ setShiftRate(shiftRate: double)
+ getShiftRate(): double
+ calculateWeeklyPay():double
Figure 3: UML Diagram for the class CasualEmployee
Each of these subclasses should provide two constructors. One takes four parameters, with the last being the
weekly wage (for PermanentEmployees) or the per-shift payment rate (for CasualEmployees). The second
constructor for each subclass omits this fourth parameter – in this case the payment-related variable should be
a set to a default value. For PermanentEmployees the default weekly wage is $812.47, while for
CasualEmployees the default payment per shift is $47.50.
Each subclass also needs to provide its own implementation of the getWeeklyWage() method. For the
PermanentEmployee class this can just return the employee's weekly wage, while for the CasualEmployee
class it should return the product of the number of shifts worked and the rate of payment per shift.
Once you have implemented these subclasses, you should extend the TestEmployee driver code to instantiate
several examples of these classes and call their method to ensure that they are working correctly.
The EmployeeDriverSystem
The final component of the scheduling software system is the EmployeeDriverSystem. This should have a
main() method, and will implement a text-driven menu to allow the company manager to work with this week's
schedule.
This driver program will be based on two array data-structures (see Week 7 for coverage of arrays):
• The first is a 1-dimensional array which will store a list of all of the company's Employees
• The second is a 2-dimensional array which will store the week's schedule. Each element in this array
corresponds to a specific day (the first index) and shift (the second index), and it stores a reference to
an Employee object. If an element contains the value null, this indicates that no Employee has been
allocated to that specific day and shift yet.
When the program first starts these array data-structures should be created to the required size. The program
should instantiate multiple Employees and store them in the employee list array. The employees should have
the following characteristics:
CRICOS Provider No. 00103D Page 4 of 15
• There should be 3 permanent employees and 7 casual employees.
• You should use both the 3 and 4 parameter variants of the constructors for the PermanentEmployee
and CasualEmployee classes (i.e. some employees will have the default pay-rates, while others may
have higher or lower pay-rates)
• You can make up the names and ID codes for all of the employees, with the exception that the first
employee should use your names, and their ID code should consist of the first three letters of your
surname followed by the 8 digits of your FedUni student number.
• The data for these Employees can be stored directly in your code.
Once the arrays have been created, the program should display the following text menu to the user. The user
should be able to repeatedly select operations from this menu, until they choose to exit the program. You
should validate the values entered by the user and print an error message and prompt them to try again if they
enter an invalid value:
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection:
The menu commands should operate as follows:
• Display all staff
o Displays a list of all the company employees (the order is not important) – see sample output at
the end of this document for the required format
• Clear schedule
o Sets all entries in the schedule to null, and all employees shifts worked to zero
• Display schedule
o Displays the current schedule, with one row per day (labelled with the day's name or
abbreviation) and the 4 shifts displayed in columns. Unallocated shifts should be indicated by
dashes. For allocated shifts the details of the allocated employee should be displayed. Refer to
the sample output at the end of this document for an example.
• Assign shift to casual employee
CRICOS Provider No. 00103D Page 5 of 15
o Prompt the user to enter both a day of the week and a shift number (these values should be
tested to make sure they are in range, and the user prompted to re-enter them if they are
invalid)
o Once a valid day and shift number have been entered, check to see if that shift has already
been allocated. If so, then the program should display an appropriate message and return to
the menu.
o If the selected shift is not allocated, the program should display a list of all casual employees
(permanent employees should not be listed)
Hint: you can use Java's instanceof operator to check if an Employee is casual or
permanent
o The user should be prompted to select an employee by entering their ID as a String
o When the ID is entered, the program should test if it matches the ID of a casual employee
o If it does, that Employee should be allocated to this shift and their shifts worked should be
incremented
o If the ID doesn't match (or if it matches a permanent employee) the program should display an
error message and ask the user to enter a new ID – repeat this until a valid ID is entered
• Assign shift to permanent employee
o Prompt the user to enter a shift number (this value should be tested to make sure it is in range,
and the user prompted to re-enter it if it is invalid)
o Check to see if this shift is unallocated for all 5 days of the week – if any day already has this
shift allocated the program should display an appropriate message and return to the menu.
o If the selected shift number is available on all days, then the program should display a list of all
permanent employees (casual employees should not be listed)
Hint: you can use Java's instanceof operator to check if an Employee is casual or
permanent
o The user should be prompted to select an employee by entering their ID as a String
o When the ID is entered, the program should test if it matches the ID of a permanent employee
o If it does, that Employee should be allocated to this shift number for all 5 days and their shifts
worked should be incremented by 5
o If the ID doesn't match (or if it matches a casual employee) the program should display an error
message and ask the user to enter a new ID – repeat this until a valid ID is entered
• Calculate total weekly wages
o The program should list the details of all employees along with their calculated pay for this week
based on the current schedule (see the printout at the back of this document for an example of
the layout required)
o The program should also total the pay across all employees and display this at the bottom of
the list
• Exit program
o The program should exit the menu loop, displaying a farewell message to the user.
CRICOS Provider No. 00103D Page 6 of 15
Important note: While the full version of the system will require you to have implemented the
CasualEmployee and PermanentEmployee classes, you can begin implementation of the menu and
some of the functionality using just the Employee class. As we will not cover inheritance until Week
10, it is important that you start earlier on the other aspects of the assignment to avoid having to
implement too much in the last week.
File handling
If you have all of the other program functionality working, a small number of marks are available for performing
the initialisation of the Employee array by loading the data from a text-file. We will not cover file-handling until
Week 10, so this should be the last feature which you add to your program.
Testing
You should be testing your program as each stage is completed, and again once the program is complete. As
well as your program code, you must submit a document detailing the testing which you have performed on
your program. This should be formatted according to the University's guidelines for academic work. This
should detail the input data given to the program, why that particular data was chosen, and the expected and
actual output from the program.
Your testing should be thorough. Your mark for this section will reflect the thoroughness of your testing and the
quality of your documentation.
Submission
Your assignment should be completed according to the General Guidelines for Presentation of Academic
Work.
The following criteria will be used when marking your assignment:
• successful completion of the required tasks
• quality of code that adheres to the programming standards for the course including:
• comments and documentation
• code layout
• meaningful variable names
• use of constants
You are required to provide documentation, contained in an appropriate file, which includes:
• a front page - indicating your name, a statement of what has been completed and acknowledgement
of the names of all people (including other students and people outside of the university) who have
assisted you and details on what parts of the assignment that they have assisted you with
• details of test data and evidence that the testing was conducted
• list of references used (APA style); please specify if none have been used.
Using the link provided in Moodle, please upload the following in one zip file:
1. your code (all of your .java files)
2. your report (surnameStudentIDAssign2.docx)
CRICOS Provider No. 00103D Page 7 of 15
If you encounter any problems in uploading files to moodle please report this to your lecturer or other staff
member as soon as possible.
It is your responsibility to check that you are submitting the correct version of your files.
NOTE: If you use any resources apart from the course material to complete your assignment you MUST
provide an in-text citation within your documentation and/or code, as well as providing a list of references in
APA formatting. This includes the use of any websites, online forums, books or text books. If you are unsure
of how to do this please ask for help.
CRICOS Provider No. 00103D Page 8 of 15
Marking Criteria/Rubric
Your program will be marked based on the extent to which it correctly implements the required
functionality. The marking scheme will also take into account whether your code is written in a
good style, as covered in classes. For example it should be well commented, use meaningful
variable names which are consistent with the Java conventions, and be clearly laid out with correct
and consistent indenting. It should also demonstrate good use of the principles of object-oriented
programming.
Employee class /10
CasualEmployee class /5
PermanentEmployee class /5
Creating and populating array of Employees /5
Creating schedule array /5
Implementing the menu, including the exit command /5
Displaying all staff /5
Clearing the schedule /5
Displaying the schedule /5
Assigning a shift to a casual employee /10
Assigning shifts to a permanent employee /10
Totalling wages /5
Reading employee data from a file /5
Testing and documentation /10
Following correct coding style
- Note: this will be limited by the % of the program which you
attempt /10
Total /20 marks /100
Feedback
Feedback will be provided either via moodle or handed back in lectures or lab classes. Wherever
possible feedback will be provided within 2 weeks of the submission of the assignment.
Plagiarism:
Plagiarism is the presentation of the expressed thought or work of another person as though it is one's
own without properly acknowledging that person. You must not allow other students to copy your work
and must take care to safeguard against this happening. More information about the plagiarism policy
and procedure for the university can be found at http://federation.edu.au/students/learning-andstudy/online-help-with/plagiarism.
CRICOS Provider No. 00103D Page 9 of 15
ITECH1000/5000 Programming 1
Sample Program Output
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 0
Invalid selection - must be between 1 and 7.
Enter your selection: 8
Invalid selection - must be between 1 and 7.
Enter your selection: 1
[VAM12345678] VAMPLEW, Peter
[SKA51515151] SKACEL, Rudi
[BLA41925612] BLACKBURN, Katie
[STE97527467] STEPHENSON, Neal
[CHE98765432] CHERRY, Neneh
[BRO97635198] BROOKMYRE, Chris
[HOP26554432] HOPPER, Grace
[XKCD1234567] MUNROE, Randall
[FRY90224718] FRYE, Kaylee
[MCG51515151] MCGOWAN, Ryan
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
CRICOS Provider No. 00103D Page 10 of 15
7. Exit program
Enter your selection: 3
MON ------------------------ ------------------------ ------------------------ ------------------------
TUE ------------------------ ------------------------ ------------------------ ------------------------
WED ------------------------ ------------------------ ------------------------ ------------------------
THU ------------------------ ------------------------ ------------------------ ------------------------
FRI ------------------------ ------------------------ ------------------------ ------------------------
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 4
Which shift do you wish to allocate to a casual employee? (1..4): 5
Invalid selection - must be between 1 and 4.
Enter your selection: 3
On which day? (1..5): 0
Invalid selection - must be between 1 and 5.
Enter your selection: 2
[STE97527467] STEPHENSON, Neal
[CHE98765432] CHERRY, Neneh
[BRO97635198] BROOKMYRE, Chris
[HOP26554432] HOPPER, Grace
[XKCD1234567] MUNROE, Randall
[FRY90224718] FRYE, Kaylee
[MCG51515151] MCGOWAN, Ryan
CRICOS Provider No. 00103D Page 11 of 15
Enter ID: [XYZ13]
Invalid selection - try again.
Enter ID: VAM12345678
Invalid selection - try again.
Enter ID: CHE98765432
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 3
MON ------------------------ ------------------------ ------------------------ ------------------------
TUE ------------------------ ------------------------ [CHE98765432] CHERRY, Neneh ------------------------
WED ------------------------ ------------------------ ------------------------ ------------------------
THU ------------------------ ------------------------ ------------------------ ------------------------
FRI ------------------------ ------------------------ ------------------------ ------------------------
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 5
Which shift do you wish to allocate to a permanent employee? (1..4): 3
That shift has already been allocated on at least one day this week.
CRICOS Provider No. 00103D Page 12 of 15
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 5
Which shift do you wish to allocate to a permanent employee? (1..4): 1
[VAM12345678] VAMPLEW, Peter
[SKA51515151] SKACEL, Rudi
[BLA41925612] BLACKBURN, Katie
Enter ID: SKA51515151
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 3
MON [SKA51515151] SKACEL, Rudi ------------------------ ------------------------ ------------------------
TUE [SKA51515151] SKACEL, Rudi ------------------------ [CHE98765432] CHERRY, Neneh ------------------------
WED [SKA51515151] SKACEL, Rudi ------------------------ ------------------------ ------------------------
THU [SKA51515151] SKACEL, Rudi ------------------------ ------------------------ ------------------------
FRI [SKA51515151] SKACEL, Rudi ------------------------ ------------------------ ------------------------
MENU
CRICOS Provider No. 00103D Page 13 of 15
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 6
[VAM12345678] VAMPLEW, Peter $3221.15
[SKA51515151] SKACEL, Rudi $812.47
[BLA41925612] BLACKBURN, Katie $812.47
[STE97527467] STEPHENSON, Neal $0.0
[CHE98765432] CHERRY, Neneh $58.2
[BRO97635198] BROOKMYRE, Chris $0.0
[HOP26554432] HOPPER, Grace $0.0
[XKCD1234567] MUNROE, Randall$0.0
[FRY90224718] FRYE, Kaylee $0.0
[MCG51515151] MCGOWAN, Ryan $0.0
-----------------------------------------
TOTAL WAGES FOR THIS WEEK $4904.29
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 2
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
CRICOS Provider No. 00103D Page 14 of 15
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 3
MON ------------------------ ------------------------ ------------------------ ------------------------
TUE ------------------------ ------------------------ ------------------------ ------------------------
WED ------------------------ ------------------------ ------------------------ ------------------------
THU ------------------------ ------------------------ ------------------------ ------------------------
FRI ------------------------ ------------------------ ------------------------ ------------------------
MENU
1. Display all staff
2. Clear schedule
3. Display schedule
4. Assign shift to casual employee
5. Assign shifts to permanent employee
6. Calculate total weekly wages
7. Exit program
Enter your selection: 7
Thank you for using this system.
CRICOS Provider No. 00103D Page 15 of 15