static void Main(string[] args) { // create objects Location loc = new Location { Description = "Head Office", City = "Glasgow" }; Employee emp1 = new Employee(1, "Michael", "michael", loc, "1234"); TimeSheet ts = new TimeSheet(); // send messages (call methods) emp1.RecordOvertime(ts, 5, PayRate.Holiday); // wait for key press before ending Console.ReadLine(); }
// end RecordOvertime /// <summary> /// gets the total overtime recorded for this employee in the specified time sheet /// </summary> /// <param name="timeSheet">the time sheet</param> /// <returns>the total hours recorded</returns> public int TotalOvertime(TimeSheet timeSheet) { // get total overtime hours recorded in the specified timesheet // for this employee - we will fill in the details of this later, // just return an arbitrary value for now return 100; }
// end Move /// <summary> /// records an overtime entry in a specified time sheet /// </summary> /// <param name="timeSheet">the time sheet</param> /// <param name="hours">the number of hours to record</param> /// <param name="payRate">payrate enumerated value</param> public void RecordOvertime(TimeSheet timeSheet, int hours, PayRate payRate) { if (payRate == PayRate.Holiday) { timeSheet.AddEntry(name, hours * 3); } else if (payRate == PayRate.Weekend) { timeSheet.AddEntry(name, hours * 2); } else { timeSheet.AddEntry(name, hours); } }