Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CODE IT IN JAVA THX!!! THIS A PROBLEM ABOUT TWO LINKED CLASSES !!! JUST FOLLOW THE INSTRUCTIONS AND WRITE THE STRUCTURE!!! The Building class The

CODE IT IN JAVA THX!!!

THIS A PROBLEM ABOUT TWO LINKED CLASSES !!! JUST FOLLOW THE INSTRUCTIONS AND WRITE THE STRUCTURE!!!

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

The Building class The Building class is pretty straight forward as you can see below. You can tackle this even before you're finished with your Student class in problem 1. Building -buildingName: String -numberFloors: int -campusLocation: String +Building (name: String, floors: int, campus: String) +getBuildingName (): String +getCampus (): String +hasMoreFloors (otherBuilding: Building): int +toString(): String Description of methods from the Building class: +Building (name: String, floors: int, campus: String) Constructs a building with building name, number of floors and located on the specified campus name. +getBuildingName () : String Returns the building name. +getCampus (): String Returns a campus that a building is located on. thasMoreFloors (otherBuilding: Building): int Compares the number of floors that the building has to another Building object. It returns the number of floor that it has more than the other one if taller the numberinnocitie thasMoreFloors (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. +toString(): String Overrides the existing string representation of the object to be: building-name + " building (" + num-floors + " floors), " + campus + " campus" The Room class The Room class relies on the Building class as previously created. Room -building: Building -roomNumber: int -roomCapacity: int +Room (building: Building, room: int, capacity: int) +getBuilding () : Building +getRoomCapacity (): int +setRoomCapacity (capacity: int): void +toString(): String +setRoomCapacity (capacity: int): void Sets a new capacity for a room (e.g. if the room was expanded during a remodel). +toString(): String Overrides the existing string representation of the object to be: building-name + " building, Room " + roomNumber + " (seats " + capacity + ")

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions