static void Main(string[] args) { // create objects Location loc = new Location { Description = "Head Office", City = "Glasgow" }; Employee emp1 = new Employee("Michael", "michael", loc, "1234"); Employee emp2 = new Employee("Susan", "susan", loc, "4321"); Employee emp3 = new Employee(); TimeSheet ts = new TimeSheet(); // use properties string uname = emp2.Username; Console.WriteLine("Email address for Susan is {0}", emp2.Email); emp2.PhoneNumber = "5678"; TimeSheet.MaxEntries = 100; // send messages (call methods) emp1.RecordOvertime(ts, 5, true); // note that as a result of this, emp1 sends a message to ts int overTime = emp1.TotalOvertime(ts); Console.WriteLine("total hours for Michael: {0}", overTime); TimeSheet.IncreaseMaxEntriesBy(50); // wait for key press before ending Console.ReadLine(); double angle = Math.PI; double result = Math.Sin(angle); }
/// <summary> /// default constructor /// </summary> public Employee() { this.name = "default"; this.username = "******"; this.currentLocation = null; this.phoneNumber = "0000"; }
//CONSTRUCTORS /// <summary> /// constructor for Employee objects /// </summary> /// <param name="name">the employee's name</param> /// <param name="username">the employee's username</param> /// <param name="location">the employee's initila location</param> /// <param name="phoneNumber">the employee's phone number</param> public Employee(string name, string username, Location location, string phoneNumber) { this.name = name; this.username = username; this.currentLocation = location; this.phoneNumber = phoneNumber; }
//METHODS /// <summary> /// Move to a new location /// </summary> /// <param name="newLocation">the new location</param> public void Move(Location newLocation) { currentLocation = newLocation; }