Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Timekeeping

Class Employee
Contains employee ID, shifts, if the employee is present, a sign in and sign out date and a specific
shift. Uses the employee, schedule and shift classes

Instance Variables
private String empID;
private Date signIn, signOut;
private Schedule shifts;
private boolean isPresent;
private Shift shift;

Constructors
public Employee(String empID)
//create employee with the given empID.

Methods
public void signIn()
//set the signIn date to the date and time of sign in.
//set isPresent to true.
public void signOut()
//set signOut to the date and time of sign out.
//set isPresent to false.
//set shift to the signIn and signOut date.
//add shift to shifts.
public boolean isPresent()
//return the state of isPresent.
public boolean checkPresent(int day, int month, int year)
//check if an employee was present on a specific day.
public int getHours(int week, int year)
//returns the hours worked on a specific week.
public ArrayList getWeek(int week, int year)
// returns the shifts worked in a specific week.
public Shift shift(int day, int month, int year)
//return the shift details on a specific day.

Class Shift
Contains a sign in and sign out date.

Instance Variables
private Date signIn, signOut;

Constructors
public Shift(Date signIn, Date signOut)
//create shift with the given dates.

Methods
public int getWeek()
//return the week of the shift.
public int getYear()
//return the year of the shift.
public int getDay()
//return the day of the shift.
public int getHours()
//return the length of the shift in hours.

Class Schedule
Contains an ArrayList of shifts. Used the shift and BusinessWeek class.

Instance Variables
private ArrayList shifts;

Constructors
public Schedule()
//initialise the arraylist.

Methods
public void addShift(Shift shift)
//add a new shift to the arraylist.
public shift getShift(int day, int week, int year)
//return a specific shift.
public ArrayList getWeek(int week, int year)
//return a specific week of schedules
public int getHours(int week, int year)
//return a specific hours worked in the week.

Class BusinessDate
Contains date to business date and vice versa.

Constructors
public BusinessDate()
//create a new object.

Methods
public int getWeek(Date date)
//return the week according to the business date model.
public int getDay(Date date)
//return the day according to the business date model.
public int getYear(Date date)
//return the year according to the business date model.
public Date getDate(int day, int week, int year)
//converts the business week model date to actual date.

You might also like