public override void Execute() { Employee e = database.GetEmployee(empId); if (e != null) { HourlyClassification hc = e.Classification as HourlyClassification; if (hc != null) { hc.AddTimeCard(new TimeCard(date, hours)); } else { throw new InvalidOperationException( "Tried to add timecard to non-hourly employee"); } } else { throw new InvalidOperationException("No such employee."); } }