Question: How do I implement a HasMoreFloors method in my object class? public class Building{ private String buildingName; private int numberFloors; private String campusLocation; public Building(String

How do I implement a HasMoreFloors method in my object class?

How do I implement a HasMoreFloors method in my object class? public

public class Building{ private String buildingName; private int numberFloors; private String campusLocation; public Building(String name, int floors, String campus){ this.buildingName = name; this.numberFloors = floors; this.campusLocation = campus; }

public hasMoreFloors(Building otherBuilding){

}

+hasMoreFloors (otherBuilding: Building): int Compares the number of floors that the building has to another Building object. It returns the number of floors that it has more than the other one. If taller, the number is positive (i.e. returning 3 implies that it has more floors that then "other building"). If equal, the two buildings are of the same height. If negative, the other building is the taller of the two

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!