subject
Engineering, 16.04.2021 08:50 hanhann6895

Using only try java : Implement the class as depicted in the UML diagram.
Apartment

-city: String
-area: double
-nbOfRooms: int
-duplex: boolean
+num_apt: int
+Apartment(All data fields)
+getCity(): String
+getNumberOfStories(): int
+assessSize(): String
+printDescription(): void

Data Fields:
1. city: It may consist of one word or two such as “Beirut”, “Bint Jbeil”, etc.
2. area: its value is expressed in square meter
3. nbOfRooms: with maximum value of 10
4. duplex: either true or false to reflect whether the apartment is made of two stories or only a single one.
5. num_apt: to keep track of how many apartment objects were created.
Methods:
1. A constructor that creates an Apartment object with the specified values of all data fields. If the number
of rooms passed is greater than 10, then nbOfRooms is set to 0.
2. getCity(): this method returns the city with its letters all capitalized.
3. getNumberOfStories(): This method returns the number of stories of an apartment. If it is duplex, then 2
is returned otherwise 1 is returned.
4. assessSize(): This method returns “Spacious” if the area is greater than 150 square meter, “Small” if it is
less than 100 and “Medium” otherwise.
5. printDescription(): Method that displays the information of the apartment as in the following examples:

Example 1 Spacious 2 stories Apt in HAMRA - 250.0 (sqm) - 6 room(s)
Example 2 Small 1 story Apt in ZAHLE- 50.0 (sqm) - 1 room

Question 2 [30 points]:
Implement a client class to test the Apartment class as follows:
1. Create an array of Apartment objects of size 5.
2. Fill it with five Apartment objects according to your choice as a programmer (NOT from the user)
3. Print the description of all apartments in the array which are located in “Beirut”
4. Display the size assessment of each apartment in the array.
5. Display the city of all apartment objects that are formed of two stories

ansver
Answers: 2

Another question on Engineering

question
Engineering, 04.07.2019 18:10
Awall of 0.5m thickness is to be constructed from a material which has average thermal conductivity of 1.4 w/mk. the wall is to be insulated with a material having an average thermal conductivity of 0.35 w/mk so that heat loss per square meter shall not exceed 1450 w. assume inner wall surface temperature of 1200°c and outer surface temperature of the insulation to be 15°c. calculate the thickness of insulation required.
Answers: 3
question
Engineering, 04.07.2019 19:10
What is the main objective of using reheat rankine cycle?
Answers: 3
question
Engineering, 04.07.2019 19:10
Air inially occupying a volume of 1 m2 at 100 kpa, 27 c undergoes three internally reversible processes in series. process 1-2 compression to 500 kpa during which pv constant process 2-3 adiabatic expanslon to 100 kpa process 3-1: constant-pressure expansion to 100 kpa (a) calculate the change of entropy for each of the three processes. (b) calculate the heat and work involved in each process. (c) is this cycle a power cycle or refrigeration cycle?
Answers: 3
question
Engineering, 04.07.2019 19:10
When subject to a steady load (within elastic range) over a long period of time, what is the major difference in material behavoir between steel and plastic?
Answers: 2
You know the right answer?
Using only try java : Implement the class as depicted in the UML diagram.
Apartment
Questions
question
Mathematics, 14.08.2021 08:40
question
English, 14.08.2021 08:40
question
Biology, 14.08.2021 08:40
question
English, 14.08.2021 08:40
question
Biology, 14.08.2021 08:50
question
Health, 14.08.2021 08:50
question
Biology, 14.08.2021 08:50
question
Mathematics, 14.08.2021 08:50
Questions on the website: 13722360