static void Main(string[] args) { // INHERITANCE // Employee and Customer both inherit from the Person class Customer Joey = new Customer(); Joey.sayHi(); Joey.SubmitMaintenanceRequest("The sink is broken"); Employee David = new Employee("Master of the Universe"); David.SubmitMaintenanceRequest("The door is also broken"); // ASSOCIATION // Composition- buildings and rooms Building ChaseBuilding = new Building(); Room Hackery = new Room(50, 300); ChaseBuilding.addRoomToBuilding(Hackery); ApartmentBuilding heritage = new ApartmentBuilding() { numberOfUnits = 6 }; Office theOffice = new Office() { nameOfCompany = "Dunder Mifflin" }; House myHouse = new House() { numberOfBedrooms = 7 }; David.constructBuilding(heritage); David.constructBuilding(theOffice); David.constructBuilding(myHouse); Room basicRoom = new Room(200, 400); // Aggregation- companies and employees || companies and customers Company AwesomeDoorCompany = new Company(); AwesomeDoorCompany.EmployeeList.Add(David); David.Company = AwesomeDoorCompany; // add rooms to a building heritage.addRoomToBuilding(basicRoom); theOffice.addRoomToBuilding(basicRoom); theOffice.addRoomToBuilding(Hackery); Console.WriteLine($"This is the area of The Office {theOffice.totalArea}"); Console.WriteLine($"This is the average room size of The Office {theOffice.getAverageRoomSize}"); theOffice.estimateCost(1.50, "The Office"); }
//Give your Employee class the ability to construct different buildings. // This method should write to the console a confirmation that the building is under construction. This method should have different behavior based on what type of building it recieves as an argument. For example, if you pass it an instance of the ApartmentBuilding class, it should write something to the console like "Now building {x} number of units in the apartment building!" (Hint: method overloading!) public void constructBuilding(ApartmentBuilding buildingParam) { Console.WriteLine($"Now building {buildingParam.numberOfUnits} units in the apartment building."); }