Question: > Similar +isSimilar(o:Object):boolean DataCenter - name: String - nbDevices : int - devices: Devicel) Device #id: int #brand: String +DataCenter (name: String, maxNbDevices:int) +getDevices():Device +addDevice(d:



> Similar +isSimilar(o:Object):boolean DataCenter - name: String - nbDevices : int - devices: Devicel) Device #id: int #brand: String +DataCenter (name: String, maxNbDevices:int) +getDevices():Device +addDevice(d: Device): boolean +displayServers():void +toString():String +Device( all arguments) +toString():String Network Device Server -operating System Type: String -availableServices: String -nbOfPorts: int -powerOverEthernet boolean +NetworkDeviceall arguments) +toString(: String getters and setters +Server (all arguments) =toString(): String +addAService( service:String): boolean +findAServie( service String): boolean getters and setters A. Device Class (An Abstract Class) The toString method returns a String of the form "Id:...,Brand: B. Server Class It has two private attributes: o operating System Type: the type of the installed operating system (ex: Linux Windows, etc) o availableServices: it is a string that contains all the installed services. It is of the following form: Servicel.Service2:Service3. Example: DHCP:DNS:MailService:WebService The method addAService takes the name of the new service and adds it at the end of the string availableServices, if it does not already exist. It returns false if the service is already installed, and true otherwise. The method findAService takes the name of a service and returns true if it is installed on this server, and false otherwise. The method is Similar should be implemented in this class. It is used to compare two servers. Two servers are similar if they have the same brand, same operating system type and same installed services. The toString method returns a string with the following format: Server: Id: 123. Brand: Lenove, Operating System: Windows Services : DHCP, DNS, Mail C. DataCenter Class The data field nb Devices keeps tracking the number of devices added to the devices array. The constructor accepts an int parameter maxNb Devices which indicates the maximum number of Device Objects that could be added to the devices array The method addDevice takes a Device Object and adds it to the array only if no similar object is present in the array. You should use the isSimilar method to check if two objects are similar. The method DisplayServers displays information of Server Objects found in devices array. The toString method returns a String containing information about all the Device Objects in the devices Array
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
