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
Determine whether or not it is possible to compress air adiabatically from k to 140 kpa and 400 k. what is the entropy change during this process?
Answers: 3
question
Engineering, 04.07.2019 18:20
Most leaks in reciprocating air compressors can be detected and minimized by: (clo4) a)-detecting leakage areas using ultrasonic acoustic detector. b)-tightening joints and connections c)-replacing faulty equipment d)-all of the given options
Answers: 2
question
Engineering, 04.07.2019 18:20
Avolume of 2.65 m3 of air in a rigid, insulated container fitted with a paddle wheel is initially at 264 k, 5.6 bar. the air receives 432 kj by work from the paddle wheel. assuming the ideal gas model with cv = 0.71 kj/kg ā€¢ k, determine for the air the amount of entropy produced, in kj/k
Answers: 2
question
Engineering, 04.07.2019 19:20
Liquid flows at steady state at a rate of 2 lb/'s through a pump, which operates to raise the elevation of the liquid 100 ft from control volume inlet to exit. the liquid specific enthalpy at the inlet is 40.09 btu/lb and at the exit is 40.94 btub. the pump requires 3 btu/s of power to operate. if kinetic energy effects are negligible and gravitational acceleration is 32.174 tt/s, the heat transfer rate associated with this steady state process is most closely 1)-2,02 btu/s from the liquid to the surroundings 2)-3.98 btu/s from the surroundings to the liquid. 3)-4.96 btu/s from the surroundings to the liquid. 4)-1.04 btu/s from the liquid to the surroundings.
Answers: 2
You know the right answer?
Using only try java : Implement the class as depicted in the UML diagram.
Apartment
Questions
question
World Languages, 25.07.2019 04:30